current position:Home>Hadoop environment construction (zookeeper environment construction)

Hadoop environment construction (zookeeper environment construction)

2022-01-26 21:58:40 cyjku

1. stay zookeeper Before installation , First check whether the firewall is closed

① View firewall status , command :

systemctl status firewalld

② Turn off firewall , command :

systemctl stop firewalld

③ Set startup firewall not to start , command :

systemctl disable firewalld

2. take zookeeper Install the package to /opt/software/ In the folder

3. decompression zookeeper The installation package to /opt/module/ Under the folder , command :

cd /opt/software/
tar -zxvf  Installation package name  -C  /opt/module/

4. After decompression zookeeper Under the document , establish log The folder and data Folder , command :

cd /opt/module/apache-zookeeper-3.5.7-bin/

Create command :

mkdir data
mkdir log

5. Copy configuration file

cd /opt/module/apache-zookeeper-3.5.5-bin/conf/

cp zoo_sample.cfg zoo.cfg

Profile changes

# The number of milliseconds of each tick


# The number of ticks that the initial

# synchronization phase can take


# The number of ticks that can pass between

# sending a request and getting an acknowledgement


# the directory where the snapshot is stored.

# do not use /tmp for storage, /tmp here is just

# example sakes.



# the port at which the clients will connect


# the maximum number of client connections.

# increase this if you need to handle more clients



# Be sure to read the maintenance section of the

# administrator guide before turning on autopurge.




# The number of snapshots to retain in dataDir


# Purge task interval in hours

# Set to "0" to disable auto purge feature





 6、 Create a server myid
stay data Create one in the directory myid file , The value inside can be given any value , But it has to start with the previous service server.x Corresponding , Change later

cd /opt/module/apache-zookeeper-3.5.7-bin/data/
touch myid

7、 Cluster copy , command :

scp -r /opt/module/apache-zookeeper-3.5.7-bin [email protected]:/opt/module/apache-zookeeper-3.5.7-bin
 take Hadoop100/opt/module/apache-zookeeper-3.5.7-bin Copy the files inside to Hadoop101/opt/module/apache-zookeeper-3.5.7-bin Inside 
scp -r /opt/module/apache-zookeeper-3.5.7-bin [email protected]:/opt/module/apache-zookeeper-3.5.7-bin
 take Hadoop100/opt/module/apache-zookeeper-3.5.7-bin Copy the files inside to Hadoop102/opt/module/apache-zookeeper-3.5.7-bin Inside 

 8、 colony myid change , command :
Enter each node to make changes :

cd /opt/module/apache-zookeeper-3.5.7-bin/data/

Hadoop100 Of myid, Change to 0

touch myid

Hadoop101 Of myid, Change to 1

Hadoop102 Of myid, Change to 2

9、 Add system environment variable , command :

vi /etc/profile

Add the following in the edit panel :

export ZOOKEEPER_HOME=/opt/module/apache-zookeeper-3.5.7-bin

10、zookeeper Cluster start , Each node should start

cd /opt/module/apache-zookeeper-3.5.7-bin

Start command :( stay 100、101、102 It's going to start inside ) start status

Start in turn
Be careful : start-up satus Look for it first leader,leader May be in 100、101、102 One of them , otherwise satus Will report a mistake
11、zkCli Connection verification , command : -server hadoop100:2181

Press Ctrl+Z Stop running

use jps Check to see if ZooKeeperMain process

appear QuorumPeerMain shows zookeeper Successful launch  

copyright notice
author[cyjku],Please bring the original link to reprint, thank you.

Random recommended