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

tickTime=2000

# The number of ticks that the initial

# synchronization phase can take

initLimit=10

# The number of ticks that can pass between

# sending a request and getting an acknowledgement

syncLimit=5

# the directory where the snapshot is stored.

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

# example sakes.

dataDir=/opt/module/apache-zookeeper-3.5.5-bin/data

dataLogDir=/opt/module/apache-zookeeper-3.5.5-bin/log

# the port at which the clients will connect

clientPort=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 auto purge feature

#autopurge.purgeInterval=1

server.0=192.168.1.100:2888:3888

server.1=192.168.1.101:2888:3888

server.2=192.168.1.102:2888:3888

 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
export PATH=$PATH:$ZOOKEEPER_HOME/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 )

zkServer.sh start
zkServer.sh status

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

zkCli.sh -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.
https://en.cdmana.com/2022/01/202201262158378053.html

Random recommended