In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Wednesday, 2019-3-13
The first step / / initialize the template initialization.sh https://blog.51cto.com/12445535/2362407 with execution
[root@emm-kafka01-10 cat cat 174 opt] # cat / etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@emm-kafka01-10 Murray 174 opt] # free-m total used free shared buff/cache availableMem: 3790 109 3530 8 150 3474Swap: 3967 0 3967 [root@emm-kafka01-10 root@emm-kafka01 174 opt] # df-ThFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/centos-root xfs 46G 2.2G 44G 5% / devtmpfs devtmpfs 1.9G 0 1.9G 0% / devtmpfs tmpfs 1.9G 0 1.9G 0% / dev/shmtmpfs tmpfs 1.9g 8.8m 1.9g 1% / runtmpfs tmpfs 1.9G 0 1.9g 0% / sys/fs/cgroup/dev/sda1 xfs 497M 161M 337M 33% / boottmpfs tmpfs 380M 0380M 0% / run/user/0## # # physical number of cpu physical_id: 4 number of core in each cpu (i.e. number of cores) cpu cores: 1 number of logical cpu processor: 4 numbers # #
Step two
Installation of jdk now requires version 1.8 or above.
First check whether the machine comes with jdk.
# java-versionjava version "1.7.0mm 67" Java (TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot (TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
Delete an existing jdk
Https://blog.csdn.net/cbcgkx123/article/details/80182584
[root@emm-kafka01-10 MMMI 174 usr] # rm-rf / usr/java/
Install your own jdk
[root@emm-kafka01-10 lltotal 162156-rwxr-xr-x lltotal 162156-rwxr-xr-x 174 ins] # rpm-ivh jdk-8u102-linux-x64.rpm Preparing... 1 root root 166044032 Mar 13 15:58 jdk-8u102-linux-x64.rpm [root@emm-kafka01-10 Murray 174 ins] # Mimi-ivh jdk-8u102-linux-x64.rpm Preparing... # # [100%] Updating / installing... 1:jdk1.8.0_102-2000:1.8.0_102-fcs # # [100] Unpacking JAR files... Tools.jar... Plugin.jar... Javaws.jar... Deploy.jar... Rt.jar... Jsse.jar... Charsets.jar... Localedata.jar... [root@emm-kafka01-10 Murray 174 ins] # java-version-bash: / usr/java/jdk/bin/java: No such file or directory [root@emm-kafka01-10 Murray 174 java] # vim / etc/profile#export JAVA_HOME=/usr/java/jdk#export CLASSPATH=$JAVA_HOME/jre/lib:$JAVA_HOME/lib#export PATH=$PATH:$JAVA_HOME/bin [root@emm-kafka01-10 Murray 174 java] # source / etc/profile [root@ Emm-kafka01-10 Murray 174 java] # java-version java version "1.8.0mm 102" Java (TM) SE Runtime Environment (build 1.8.0_102-b14) Java HotSpot (TM) 64-Bit Server VM (build 25.102-b14) Mixed mode)
The other two stations are executed in this way.
Step 3: set up / etc/hosts
[root@emm-kafka01-10 Murray 174 conf] # cat / etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain610.2.10.174 emm-kafka01-10 Murray 17410.2.10.175 emm-kafka02-10 Murray 17510.2.10.176 emm-kafka03-10 Murray 176 [root@emm-kafka01-10 Murray 174 conf] # scp / etc/hosts root@10.2.10.175: / etc/hostshosts 100% 254 139.6KB/s 00:00 [root@emm-kafka01-10 Murtel 174 conf] # scp / etc/hosts root@10.2.10.176:/etc/hostshosts
Step 4 install zookeeper
First download the linux installation package of zookeeper / / to install zookeeper, you must first install jdk, which is now more than 1.8.
/ / pay attention to the version control. There is no obvious bug for the online version of zookeeper3.4.8. It is necessary to control the version in production.
[root@emm-kafka01-10 root root Mar 174 ins] # lltotal 233044-rwxr-xr-x 1 root root 166044032 Mar 13 15:58 jdk-8u102-linux-x64.rpm-rw-r--r-- 1 root root 50326212 Mar 13 16:14 kafka_2.12-1.1.0.tgzMui RWMui RFT zookeeper-3.4.8.tar.gz-1 root root 22261552 Mar 13 16:14 zookeeper-3.4.8.tar.gz [root@emm-kafka01-10 Mar 174 ins] # scp kafka_2.12 -1.1.0.tgz zookeeper-3.4.8.tar.gz root@10.2.10.175:/opt/ins/kafka_2.12-1.1.0.tgz 100% 48MB 48.0MB/s 00:01 zookeeper-3.4.8.tar.gz 100% 21MB 55.0MB/s 00:00 [root@emm-kafka01-10 ins] # scp kafka_2.12-1.1.0.tgz zookeeper-3.4.8.tar.gz root@10.2.10.176:/opt/ins/kafka_2.12-1.1.0.tgz 100% 48MB 53.4MB/s 00:00 zookeeper-3.4.8.tar.gz 100% 21MB 56.4MB/s 00:00 [root@emm-kafka01-10 21MB 56.4MB/s 174ins] # tar-zxvf zookeeper-3.4.8.tar.gz-C / usr/local/ [root@emm-kafka01-10Mui Muir 174 ins] # chown-R root:root zookeeper-3 .4.8 / [root@emm-kafka01-10 conf 174 local] # ln-s zookeeper-3.4.8/ zookeeper [root@emm-kafka01-10 Muhami 174 zookeeper] # pwd/usr/local/zookeeper [root@emm-kafka01-10 conf] # cd conf/ [root@emm-kafka01-10 murmur174 conf] # lltotal 12 conf RW Mustang-1 root root 535 Feb 6 2016 configuration.xsl-rw-rw-r-- 1 root root 2161 Feb 6 2016 log4j. Properties-rw-rw-r-- 1 root root 922 Feb 6 2016 zoo_ sample.cfg [root @ emm-kafka01-10 Muyamo174 conf] # mv zoo_sample.cfg zoo.cfg [root@emm-kafka01-10Murmuri 174conf] # pwd/usr/local/zookeeper/conf [root@emm-kafka01-10Mimi 174conf] # cat zoo.cfg # The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use / tmp for storage / tmp here is just # example sakes.dataDir=/usr/local/zookeeper/data# the port at which the clients will connectclientPort=2181# the maximum number of client connections.# increase this if you need to handle more clients#maxClientCnxns=60## Be sure to read the maintenance section of the # administrator guide before turning on autopurge.## http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance## The number of snapshots to retain in dataDir#autopurge.snapRetainCount=3# Purge task interval in hours# Set to "0" to disable autopurge Feature#autopurge.purgeInterval=1server.1=10.2.10.174:2888:3888server.2=10.2.10.175:2888:3888server.3=10.2.10.176:2888:3888 [root@emm-kafka01-10 Murmur174 conf] # mkdir-p / usr/local/zookeeper/data/
* * prompt:
TickTime: this time is used as the interval between Zookeeper servers or between clients and servers to maintain a heartbeat, that is, a heartbeat is sent at each tickTime time.
DataDir: as the name implies, it is the directory where Zookeeper saves the data, and by default, Zookeeper saves log files for writing data to this directory as well.
ClientPort: this port is the port on which the client connects to the Zookeeper server (2181). Zookeeper listens on this port and accepts client access requests.
Note:
There is a pit here, that is,
Server.1=10.2.10.174:2888:3888 / / if you want to write IP here, don't write it as server.1=emm-kafka01-10 Murray 174Mel 2888Rose 3888.
Why?
If you write the host name, zk can get up, and so can kafka, but when kafka goes to parse ZK, he will have problems if he doesn't pass etc/hosts.
Inside here, let's go to IP. Pay attention here.
(where 2181 represents the port used by the client to connect to the server)
(where 2888 represents the port used for communication between leader and follower)
(among them, 3888 represents the port used for voting between follower) * *
To create a file in data, write the number of the server in zookeeper
Echo 1 > myid (must be called myid, not another name)
[root@emm-kafka01-10 Mar 174 data] # pwd/usr/local/zookeeper/data [root@emm-kafka01-10 Mar 174 data] # echo 1 > myid [root@emm-kafka01-10 Mar 174 data] # lltotal 4 root root 4 Mar 13 17:23 myid [root@emm-kafka01-10 Mar 174 data] # cat myid 1
The other two nodes are the same as above, except that the myid in the / usr/local/zookeeper/data/ directory is different.
[root@emm-kafka01-10murmur174 conf] # pwd/usr/local/zookeeper/conf [root@emm-kafka01-10murmur174 conf] # scp zoo.cfg root@10.2.10.175:/usr/local/zookeeper/conf/zoo.cfg 100% 1026 531.1KB/s 00:00 [root@emm-kafka01-10muri- 174conf] # scp zoo.cfg root@10.2.10.176:/usr/local/zookeeper/conf/zoo.cfg 1026 531.1KB/s 00:00 [root@emm-kafka02-10 Murmuri 175data] # pwd/usr/local/zookeeper/data [root@emm-kafka02-10Murray 175data] # echo 2 > myid [root @ emm-kafka03-10 Murtel 176 data] # echo 3 > myid
The above is the installation and configuration of zookeeper
Modify the startup memory size of zookeeper
Go to the bin directory of zk
Vim / app/zpy/zookeeper/bin/zkServer.sh (modify the startup script of zk)
Add: JVMPARAM= "- Xms1G-Xmx4G-Xmn2G" / / this is the standard for 8 GB of physical memory
Parameter explanation:
Java-Xmx3550m-Xms3550m-Xmn2g-Xss128k
-Xmx3550m: set the maximum available memory of JVM to 3550m.
-Xms3550m: set the initial memory of JVM to 3550m. This value can be set to the same as-Xmx to prevent JVM from reallocating memory after each garbage collection.
-Xmn2g: set the size of the younger generation to 2G. Whole JVM memory size = younger generation size + older generation size + persistent generation size. The permanent generation usually has a fixed size of 64m, so increasing the size of the younger generation will reduce the size of the old generation. This value has a great impact on system performance, and Sun officially recommends that it be configured as 3Universe 8 of the entire heap.
-Xss128k: sets the stack size for each thread. The stack size of each thread after JDK5.0 is 1m, and the stack size of each thread before is 256K. Adjust the amount of memory required by more applicable threads. Decreasing this value generates more threads under the same physical memory. However, the operating system still has a limit on the number of threads in a process, which cannot be generated indefinitely, and the experience value is about 3000 to 5000.
We are 4G physical memory.
JVMPARAM= "- Xms512M-Xmx2G-Xmn1G"
Set to the following:
[root@emm-kafka01-10 ZOOBIN 174 bin] # pwd/usr/local/zookeeper/bin [root@emm-kafka01-10 Murray 174 bin] # vim zkServer.shZOOBIN= "${BASH_SOURCE-$0}" ZOOBIN= "$(dirname" ${ZOOBIN} ")" ZOOBINDIR= "$(cd" ${ZOOBIN} ") Pwd) "JVMPARAM="-Xms512M-Xmx2G-Xmn1G "/ / the second place to add this change is: nohup" $JAVA "- Dzookeeper.log.dir=$ {ZOO_LOG_DIR}"- Dzookeeper.root.logger=$ {ZOO_LOG4J_PROP}"\-cp "$CLASSPATH" $JVMFLAGS $JVMPARAM $ZOOMAIN "$ZOOCFG" > "$ZOO_DAEMON_OUT" 2 > & 1
< /dev/null & [root@emm-kafka01-10--174 bin]# lltotal 36-rwxr-xr-x 1 root root 232 Feb 6 2016 README.txt-rwxr-xr-x 1 root root 1937 Feb 6 2016 zkCleanup.sh-rwxr-xr-x 1 root root 1056 Feb 6 2016 zkCli.cmd-rwxr-xr-x 1 root root 1534 Feb 6 2016 zkCli.sh-rwxr-xr-x 1 root root 1628 Feb 6 2016 zkEnv.cmd-rwxr-xr-x 1 root root 2696 Feb 6 2016 zkEnv.sh-rwxr-xr-x 1 root root 1089 Feb 6 2016 zkServer.cmd-rwxr-xr-x 1 root root 6817 Mar 13 18:36 zkServer.sh-rw-r--r-- 1 root root 10195 Mar 13 18:36 zookeeper.out[root@emm-kafka01-10--174 bin]# scp zkServer.sh root@10.2.10.175:/usr/local/zookeeper/bin/zkServer.sh 100% 6807 2.9MB/s 00:00 [root@emm-kafka01-10--174 bin]# scp zkServer.sh root@10.2.10.176:/usr/local/zookeeper/bin/zkServer.sh 100% 6807 2.6MB/s 00:00 同时启动3台zookeeper [root@emm-kafka03-10--176 data]# cd /usr/local/zookeeper/bin[root@emm-kafka03-10--176 bin]# lltotal 36-rwxr-xr-x 1 root root 232 Feb 6 2016 README.txt-rwxr-xr-x 1 root root 1937 Feb 6 2016 zkCleanup.sh-rwxr-xr-x 1 root root 1056 Feb 6 2016 zkCli.cmd-rwxr-xr-x 1 root root 1534 Feb 6 2016 zkCli.sh-rwxr-xr-x 1 root root 1628 Feb 6 2016 zkEnv.cmd-rwxr-xr-x 1 root root 2696 Feb 6 2016 zkEnv.sh-rwxr-xr-x 1 root root 1089 Feb 6 2016 zkServer.cmd-rwxr-xr-x 1 root root 6817 Mar 13 18:36 zkServer.sh-rw-r--r-- 1 root root 10195 Mar 13 18:36 zookeeper.out[root@emm-kafka01-10--174 bin]# ./zkServer.sh startZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper/bin/../conf/zoo.cfgStarting zookeeper ... STARTED[root@emm-kafka01-10--174 bin]# jps7849 Jps[root@emm-kafka01-10--174 bin]# cat zookeeper.out //报错信息nohup: failed to run command '/usr/java/jdk/bin/java': No such file or directory[root@emm-kafka01-10--174 local]# cd /usr/java/[root@emm-kafka01-10--174 java]# lltotal 4lrwxrwxrwx 1 root root 16 Mar 13 15:58 default ->/ usr/java/latestdrwxr-xr-x 9 root root 4096 Mar 13 15:58 jdk1.8.0_102lrwxrwxrwx 1 root root 22 Mar 13 15:58 latest-> / usr/java/jdk1.8.0_102 [root@emm-kafka01-10 ln java] # ln-s jdk1.8.0_102/ jdk # lltotal 4lrwxrwxrwx 1 root root 16 Mar 13 15:58 default-> / usr/java/latestlrwxrwxrwx 1 root root 13 Mar 13 17 48 jdk-> jdk1.8.0_102/drwxr-xr-x 9 root root 4096 Mar 13 15:58 jdk1.8.0_102lrwxrwxrwx 1 root root 22 Mar 13 15:58 latest-> / usr/java/jdk1.8.0_102
After getting up again, there was an error. The reason is that it is not possible to set myid in this way, so we have to change it to a myid like 1 / 2 / 3.
Vim zookeeper.out 2019-03-13 1749 Resolved hostname 41175 [myid:]-INFO [main:QuorumPeer$QuorumServer@149]-Resolved hostname: 10.2.10.176 toaddress: / 10.2.10.1762019-03-13 174949 vim zookeeper.out 41176 [myid:]-INFO [main:QuorumPeer$QuorumServer@149]-Resolved hostname: 10.2.10.175 toaddress: / / 10.2.10.1752019-03-13 17:49 41176 [myid:]-INFO [main:QuorumPeerConfig@331]-Defaulting to majority quorums2019-03-13 17140449 Defaulting to majority quorums2019 41179 [myid:174]-INFO [main:DatadirCleanupManager@78]-autopurge.snapRetainCount set to 32019-03-1317171441180 [myid:174]-INFO [main:DatadirCleanupManager@79]-autopurge.purgeInterval set to 02019-03-1317141441180 [myid:174]-INFO [main:DatadirCleanupManager@101]-Purge task is not Scheduled.2019-03-13 17 INFO 491193 [myid:174]-INFO [main:QuorumPeerMain@127]-Starting quorum peer2019-03-13 174949 INFO 41206 [myid:174]-INFO [main:NIOServerCnxnFactory@89]-binding to port 0.0.0.0Univer 0.0.0.0Graver 21812019-03-13 17141441215 [myid:174]-INFO [main:QuorumPeer@1019]-tickTime set to 20002019-03-13 17141441215 [myid:174]-INFO [main:QuorumPeer@1039]-minSessionTimeout set to-12019-03-13 1749 main:QuorumPeer@1039 41215 [myid:174]-INFO [main:QuorumPeer@1050]-maxSessionTimeout set to-12019-03-13 17141449 minSessionTimeout set to 41215 [myid:174]-INFO [main:QuorumPeer@1065]-initLimit set to 102019-03-13 1749purl 41224 [myid:174]-* * ERROR** [main:QuorumPeer@231]-Setting LearnerType To PARTICIPANT but 174not in QuorumPeers.2019-03-13 171749 myid:174 41228-INFO [main:QuorumPeer@533]-currentEpoch not found! Creating with a reasonable default of 0. This should only happen when you are upgrading your installation2019-03-13 17 INFO 4941234 [myid:174]-INFO [main:QuorumPeer@548]-acceptedEpoch not found! Creating with a reasonable default of 0. This should only happen when you are upgrading your installation**2019-03-13 17 ERROR 4941237 [myid:174]-ERROR [main:QuorumPeerMain@89]-Unexpected exception Exiting abnormally**java.lang.RuntimeException: My id 174not in the peer list at org.apache.zookeeper.server.quorum.QuorumPeer.startLeaderElection (QuorumPeer.java:583) at org.apache.zookeeper.server.quorum.QuorumPeer.start (QuorumPeer.java:502) at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig (QuorumPeerMain.java:153) at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun (QuorumPeerMain.java:111) At org.apache.zookeeper.server.quorum.QuorumPeerMain.main (QuorumPeerMain.java:78)
[root@emm-kafka01-10 Murmai 174 bin] # jps / / launched successfully
8292 Jps
8159 QuorumPeerMain
[root@emm-kafka01-10 Murmai 174 bin] #. / zkServer.sh stop
Verification
[root@emm-kafka01-10 Murray 174 bin] #. / zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: / usr/local/zookeeper/bin/../conf/zoo.cfgMode: follower [root@emm-kafka02-10 Murray 175 bin] #. / zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: / usr/local/zookeeper/bin/../conf/zoo.cfgMode: leader [root@emm-kafka03-10 Murray 176 bin] #. / zkServer.sh statusZooKeeper JMX enabled by defaultUsing config : / usr/local/zookeeper/bin/../conf/zoo.cfgMode: follower [root@emm-kafka01-10 root@emm-kafka01 bin] # ps-ef | grep zookeeper | grep 512root 8892 1 1 18:02 pts/0 00:00:01 / usr/java/jdk/bin/java-Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO CONSOLE-cp / usr/local/zookeeper/bin/../build/classes:/usr/local/zookeeper/bin/../build/lib/*.jar:/usr/local/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/usr/ Local/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/local/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/local/zookeeper/bin/../zookeeper-3.4.8.jar:/usr/local/zookeeper/bin/../src/java/lib/*.jar:/usr/local/zookeeper/bin/../conf:/usr/java/jdk/jre/lib:/usr/java/jdk / lib-Xms512M-Xmx2G-Xmn1G-Dcom.sun.management.jmxremote-Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain / usr/local/zookeeper/bin/../conf/zoo.cfg
You'll see-Xms512M-Xmx2G-Xmn1G
[root@emm-kafka01-10 ps 174 bin] # ps-ef | grep zookeeper | grep 512root 11417 18 18:36 pts/0 00:00:01 java-Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO CONSOLE-cp / usr/local/zookeeper/bin/../build/classes:/usr/local/zookeeper/bin/../build/lib/*.jar:/usr/local/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/usr/ Local/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/local/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/local/zookeeper/bin/../zookeeper-3.4.8.jar:/usr/local/zookeeper/bin/../src/java/lib/*.jar:/usr/local/zookeeper/bin/../conf:-Xms512M-Xmx2G-Xmn1G-Dcom.sun.management.jmxremote-Dcom .sun.management.jmxremote.local.only = false org.apache.zookeeper.server.quorum.QuorumPeerMain / usr/local/zookeeper/bin/../conf/zoo.cfg
Error
[root@emm-kafka01-10murmur174 bin] #. / zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: / usr/local/zookeeper/bin/../conf/zoo.cfgError contacting service. It is probably not running. [root@emm-kafka01-10 Muhami 174 bin] # vim zookeeper.out 2019-03-13 1818 Vera 25V 13593 [myid:1]-WARN [WorkerSender [myid = 1]: QuorumCnxManager@400]-Cannot open channel to 2 at election address / 10.2.10.175Vol 3888
There is no correlation between zookeeper, this is blocked by firewall.
Because iptables didn't shut down.
Service iptables stop
Chkconfig iptables off
Execution
/ bin/systemctl stop iptables.service
Systemctl disable iptables.service**
Configure environment variables
Echo 'export PATH=/usr/local/zookeeper/bin:$PATH' > > / etc/profile
Source / etc/profile
[root@emm-kafka01-10 bin 174 bin] # echo 'source > / etc/profile [root@emm-kafka01-10 Murray 174 bin] # tail-1 / etc/profileexport PATH=/usr/local/zookeeper/bin:$PATH [root@emm-kafka01-10 bin] # source / etc/profile [root@emm-kafka01-10 bin] # which zkServer.sh/usr/local/zookeeper/bin/zkServer.sh [root@emm- Kafka01-10murmur174 bin] # cd ~ [root@emm-kafka01-10murmur174] # zkServer.sh restartZooKeeper JMX enabled by defaultUsing config: / usr/local/zookeeper/bin/../conf/zoo.cfgZooKeeper JMX enabled by defaultUsing config: / usr/local/zookeeper/bin/../conf/zoo.cfgStopping zookeeper. STOPPEDZooKeeper JMX enabled by defaultUsing config: / usr/local/zookeeper/bin/../conf/zoo.cfgStarting zookeeper... STARTED [root@emm-kafka01-10 zkServer.sh statusZooKeeper JMX enabled by defaultUsing config 174] # zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: / usr/local/zookeeper/bin/../conf/zoo.cfgMode: followe [root@emm-kafka01-10 Murray 174 bin] # netstat-lntupActive Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0127.0.0.1 Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 25 0 .0.0.0: * LISTEN 1316/master tcp 0 0 0.0.0.0 LISTEN 1316/master 22 0.0.0.0 LISTEN 1316/master 0:: 1:25 Tcp6 0 0: 2181: * LISTEN 11417/java tcp6 0 0 10.2.10.174 LISTEN 11417/java tcp6 0 0: 40466:: * LISTEN 11417/java tcp6 0 0: 22: * LISTEN 1102/sshd [root@emm-kafka02-10 Murray 175 bin] # netstat-lntupActive Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0 .1:25 0.0.0.0 LISTEN 1313/master tcp * 0 0.0.0.0 22 0.0.0.0 0:: 1:25:: * LISTEN 1313/master tcp6 0 0: 41921: * LISTEN 10182/java tcp6 0 0: 2181: * LISTEN 10182/java tcp6 00 10.2.10.175 : * LISTEN 10182/java tcp6 0 0 10.2.10.175 LISTEN 1102/sshd root@emm-kafka03: * LISTEN 10182/java tcp6 0 0: 22:: * LISTEN 1102/sshd root@emm-kafka03-10 -- 176bin] # netstat-lntupActive Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1 lntupActive Internet connections 25 0.0.0.0 * LISTEN 1316/master tcp 00 0.0.0.0 22 0.0.0 .0: * LISTEN 1104/sshd tcp6 0 0:: 1:25:: * LISTEN 1316/master tcp6 0 0: 42047:: * LISTEN 11520/java tcp6 0 0 0 : 2181:: * LISTEN 11520/java tcp6 0 010.2.10.176 LISTEN 11520/java tcp6 0 0: 22:: * LISTEN 1104 / sshd [root@emm-kafka03-10 Murray 176 bin] #
We found that only leader has 2888 ports, and each of the 3888 has 2181 ports without zookeeper listening, and each has
Zookeeper installation completed
What is the use of the zookeeper command line client and the function test [root@emm-kafka01-10Murmuri 174174] # zkCli.sh-server 10.2.10.174Connecting to 10.2.10.1742019-03-13 19Vera 40purl 04797 [myid:]-INFO [main:Environment@100]-Client environment:zookeeper.version=3.4.8--1 Built on 02Accord 06 built on 03:18 in 2016 GMT2019-03-13 1940 purge 04806 [myid:]-INFO [main:Environment@100]-Client environment:host.name=emm-kafka01-10 Rashi 1742019-03-13 1940 Vista 04807 [myid:]-INFO [main:Environment@100]-Client environment:java.version=1.8.0_1022019-03-13 1940 purge 04812 [myid:]-INFO [main:Environment@100]-Client environment:java.vendor=Oracle Corporation2019-03-13 1940 INFO 04813 [myid:]-INFO [main:Environment@100]-Client environment:java.home=/usr/java/jdk1.8.0_102/jre2019-03-13 19V 40V 04813 [myid:]-INFO [main:Environment@100]-Client environment:java.class.path=/usr/local/zookeeper/bin/../build/classes:/usr/local/zookeeper/bin/../build/lib/*.jar:/usr/ Local/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/usr/local/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/local/zookeeper/bin/../lib/jline-0.9.94 .jar:/usr/local/zookeeper/bin/../zookeeper-3.4.8.jar:/usr/local/zookeeper/bin/../src/java/lib/*.jar:/usr/local/zookeeper/bin/../conf:2019-03-13 1919 40 main:Environment@100 04814 [myid:]-INFO [main:Environment@100]-Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr / lib2019-03-13 1940RV 04814 [myid:]-INFO [main:Environment@100]-Client environment:java.io.tmpdir=/tmp2019-03-13 1940Rd 04814 [myid:]-INFO [main:Environment@100]-Client environment:java.compiler=2019-03-13 1940Rd 04814 [myid:]-INFO [main:Environment@100]-Client environment:os.name=Linux2019-03-13 1940Rd 04815 [myid:]-INFO [ Main:Environment@100]-Client environment:os.arch=amd642019-03-13 1940 INFO 04815 [myid:]-INFO [main:Environment@100]-Client environment:os.version=3.10.0-862.14.4.el7.x86_642019-03-13 191940 INFO 04815 [myid:]-INFO [main:Environment@100]-Client environment:user.name=root2019-03-13 1940 myid:]-INFO [main:Environment@100]- Client environment:user.home=/root2019-03-13 1919 main:Environment@100 40RV 04816 [myid:]-INFO [main:Environment@100]-Client environment:user.dir=/root2019-03-13 19Rd 40Rd 04819 [myid:]-INFO [main:ZooKeeper@438]-Initiating client connection ConnectString=10.2.10.174 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@506c589eWelcome to myid:]-INFO [main-SendThread (10.2.10.174VO2181): ClientCnxn$SendThread@1032]-Opening socket connection to server 10.2.10.174GUBE 10.2.10.174GULING 2181. Will not attempt to authenticate using SASL (unknown error) JLine support is enabled2019-03-13 1915 40 JLine support is enabled2019 05038 [myid:]-INFO [main-SendThread (10.2.10.174VO2181): ClientCnxn$SendThread@876]-Socket connection established to 10.2.10.174Those 10.2.10.174G1181 Initiating session2019-03-13 19 INFO 40RV 05055 [myid:]-INFO [main-SendThread (10.2.10.174VO2181): ClientCnxn$SendThread@1299]-Session establishment complete on server 10.2.10.174GUBE 10.2.10.174Rose 2181, sessionid = 0x16976d0bd810001 Negotiated timeout = 30000WATCHER::WatchedEvent state:SyncConnected type:None path:null [zk: 10.2.10.174 (CONNECTED) 0] ls / [zookeeper] [zk: 10.2.10.174 (CONNECTED) 1] ls / zookeeper [quota] [zk: 10.2.10.174 (CONNECTED) 2] ls / zookeeper/quota [] [zk: 10.2.10.174 (CONNECTED) 3] get / zookeeper/quotacZxid = 0x0ctime = Thu Jan 01 08:00:00 CST 1970mZxid = 0x0mtime = Thu Jan 01 08: 00:00 CST 1970pZxid = 0x0cversion = 0dataVersion = 0aclVersion = 0ephemeralOwner = 0x0dataLength = 0numChildren = 0 [zk: 10.2.10.174 (CONNECTED) 4] get / zookeeper cZxid = 0x0ctime = Thu Jan 01 08:00:00 CST 1970mZxid = 0x0mtime = Thu Jan 01 08:00:00 CST 1970pZxid = 0x0cversion =-1dataVersion = 0aclVersion = 0ephemeralOwner = 0x0dataLength = 0numChildren = 1
Startup script for zookeeper
[root@emm-kafka03-10 root@emm-kafka03 root@emm-kafka03 176 scripts] # cat zkstart.sh #! / bin/bashsource / etc/profilezkServer.sh restartsleep 1zkServer.sh statussleep 3 [root@emm-kafka01-10 Murray 174 scripts] # sh / opt/scripts/zkstart.shZooKeeper JMX enabled by defaultUsing config: / usr/local/zookeeper/bin/../conf/zoo.cfgZooKeeper JMX enabled by defaultUsing config: / usr/local/zookeeper/bin/../conf/zoo.cfgStopping zookeeper. No zookeeper to stop (could not find file / usr/local/zookeeper/data/zookeeper_server.pid) ZooKeeper JMX enabled by defaultUsing config: / usr/local/zookeeper/bin/../conf/zoo.cfgStarting zookeeper. STARTEDZooKeeper JMX enabled by defaultUsing config: / usr/local/zookeeper/bin/../conf/zoo.cfgMode: follower [root@emm-kafka01-10 Murmuri 174 scripts] # jps7974 QuorumPeerMain9998 Jps
You can set boot self-startup.
Chmod + x / etc/rc.d/rc.localecho "/ usr/bin/sh / opt/scripts/zkstart.sh" > > / etc/rc.d/rc.local
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.