Build JEESZ distributed architecture 7 -- install Zookeeper registration center and jeesz7 -- zookeeper

Source: Internet
Author: User

Build JEESZ distributed architecture 7 -- install Zookeeper registration center and jeesz7 -- zookeeper

ZooKeeper is a Distributed open-source framework that provides basic services for coordinating Distributed applications. It exposes a set of general services to external applications-Distributed Synchronization ). naming Service (Naming Service ). cluster Maintenance (Group Maintenance) Simplifies the coordination and management of distributed applications and provides high-performance distributed services. ZooKeeper can be installed and run in Standalone mode. However, ZooKeeper ensures the stability and availability of ZooKeeper clusters through distributed ZooKeeper clusters (one Leader and multiple Follower) based on certain policies, in this way, the reliability of distributed applications is achieved. (I copied it online for your convenience. Please do not speak !!)

Here, we will first explain the installation of a Single Node (the cluster installation mode will be provided later). Because of the direct operation, the following detailed steps are recorded:

ZooKeeper Standalone Mode

1. Modify the/etc/hosts file of the operating system to add

# Zookeeper servers (Host IP jeesz-provider-01)

[Root @ cloud ~] # Vi/etc/hosts

Xxx. xxxjeesz-provider-01

2. Go to http://apache.fayea.com/zookeeper/download zookeeper-3.4.6

[Root @ cloud ~] # Wgethttp: // apache.fayea.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz

Because I downloaded it in advance and uploaded it to my specified directory:/home/jeesz

3. decompress the zookeeper installation package

[Root @ cloud jeesz] tar -zxvfzookeeper-3.4.6.tar.gz

4. Create the following directory under the/home/jeesz/zookeeper-3.4.6 directory

[Root @ cloud ~] # Cd/home/jeesz/zookeeper-3.4.6

[Root @ cloud zookeeper-3.4.6] # mkdirdata

The [root@cloudzookeeper-3.4.6] # mkdir logs

5. Copy the zoo_sample.cfg file under the zookeeper-3.4.6/conf directory and name it zoo. cfg.

[Root @ cloudconf] # cpzoo_sample.cfg zoo. cfg

6. Modify the zoo. cfg configuration file

[Root @ cloud conf] # vizoo. cfg

# The number ofmilliseconds of each tick

TickTime = 2000

# The number of ticksthat the initial

# Synchronization phasecan take

InitLimit = 10

# The number of ticksthat can pass

# Sending a request and getting an acknowledgement

SyncLimit = 5

# The directory wherethe snapshot is stored.

# Donot use/tmp for storage,/tmp here is just

# Example sakes.

DataDir =/home/jeesz/zookeeper-3.4.6/

DataLogDir =/home/jeesz/zookeeper-3.4.6/logs

# The port at which theclients will connect

ClientPort = 2181

#2888,3888 are election port

Server.1 = jeesz-provider-01: 2888: 3888

7. Create a myid file under/home/jeesz/zookeeper-3.4.6/data

Edit the myid file and enter the corresponding number on the machine of the corresponding IP address. For example, on zookeeper, myid

The file content is 1. If you only install and configure on a single point, there is only one server.1.

[Root @ cloud data] # vi myid

1

8. Modify vi/home/jeesz/. bash_profile under the jeesz user to add zookeeper Configuration

[Root @ cloud ~] Vi/home/jeesz/. bash_profile

# Zookeeper env

ExportZOOKEEPER_HOME =/home/jeesz/zookeeper-3.4.6

ExportPATH = $ ZOOKEEPER_HOME/bin: $ PATH

Make the configuration file take effect

[Root @ cloud ~] # Source/home/jeesz/. bash_profile

9. open the port 2181.2888.3888 to be used in the firewall

Switch to the root user permission and run the following command:

[Root @ cloud ~] # Chkconfig iptables on

[Root @ cloud ~] # Service iptables start

Edit/etc/sysconfig/iptables

[Root @ cloud ~] # Vi/etc/sysconfig/iptables

Add the following three lines:

-A input-m state -- stateNEW-m tcp-p tcp -- dport 2181-j ACCEPT

-A input-m state -- stateNEW-m tcp-p tcp -- dport 2888-j ACCEPT

-A input-m state -- stateNEW-m tcp-p tcp -- dport 3888-j ACCEPT

Restart Firewall:

[Root @ cloud ~] Service iptables restart

View the firewall port status:

[Root @ cloud] # serviceiptables status

Table: filter

Chain INPUT (policyACCEPT)

Num target prot opt source destination

1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 stateRELATED, ESTABLISHED

2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0

3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0

4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt: 22

5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-withicmp-host-prohibited

6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt: 8080

7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt: 2181

8 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt: 2888

9 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 status NEW tcp dpt: 3888

 

Chain FORWARD (policyACCEPT)

Num target prot opt source destination

1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-withicmp-host-prohibited

 

Chain OUTPUT (policyACCEPT)

Num target prot opt source destination

10. Start and test zookeeper

(1) to the/home/jeesz/zookeeper-3.4.6/bin directory, execute:

[Root @ cloud bin] # zkServer. shstart

(2) enter the jps command to view the process:

[Root@cloudzookeeper-3.4.6] # jps

Jps 48064

47348 QuorumPeerMain

46826 Bootstrap

QuorumPeerMain is the zookeeper process and starts normally.

(3) view the status:

[Root @ cloud bin] # zkServer. shstatus

JMX enabled by default

Using config:/home/jeesz/zookeeper-3.4.6/bin/../conf/zoo. cfg

Mode: standalone

(4) view the zookeeper service output information:

Because the service information output file is in/home/jeesz/zookeeper-3.4.6/bin/zookeeper. out

[Root @ cloudbin] # tail-fzookeeper. out

02:20:14, 500 [myid:]-INFO [main: QuorumPeerConfig @ 103]-Reading configuration from:/home/jeesz/zookeeper-3.4.6/bin/./conf/zoo. cfg

02:20:14, 700 [myid:]-ERROR [main: QuorumPeerConfig @ 289]-Invalid configuration, only oneserver specified (ignoring)

......

11. Stop the zookeeper Process

[Root @ cloudbin] # zkServer. shstop

12. Configure zookeeper to start up with the jeesz user

Edit the/etc/rc. local file and add:

[Root @ cloudbin] # vi/etc/rc. local

Su-jeesz-c '/home/jeesz/zookeeper-3.4.6/bin/zkServer. sh start'

 

For more details, click the Source Code address.:Mingli.com

If you are interested, you can go to the ball ~ Sharing learning technologies: 2042849237

Keep an eye on building the JEESZ distributed architecture 8-message-oriented middleware installation ticket and multiple nodes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.