Three: Cluster installation configuration
##############################################################
Configuring the Zookeeper Cluster (172.16.7.12~13 execution)
###############################################################
1: Introduction to the deployment environment:
Server IP address host name installation service
172.16.7.12ctn-7-12.ptmind.com zookeeper myid=1
172.16.7.13ctn-7-13.ptmind.com zookeeper myid=2
172.16.7.14ctn-7-14.ptmind.com zookeeper myid=3
2: Install package
Yum-y Install Mesos Mesosphere-zookeeper
3: Configuration Reference (172.16.7.12):
Create ID
Touch/var/lib/zookeeper/myid
echo 1 >/var/lib/zookeeper/myid #其它节点配置需要修改ID
More/var/lib/zookeeper/myid
Adding a cluster configuration file
Cat << EOF >>/etc/zookeeper/conf/zoo.cfg
server.1=ctn-7-12.ptmind.com:2888:3888
server.2=ctn-7-13.ptmind.com:2888:3888
server.3=ctn-7-14.ptmind.com:2888:3888
Eof
Start the service, add boot boot
Systemctl Start Zookeeper.service
Systemctl Status Zookeeper.service
Systemctl Enable Zookeeper
Adding Zookeeper Environment variables
Vim/etc/profile
#追加zookeeper在尾部:/opt/mesosphere/zookeeper/bin
。。。。 Slightly...
Export path=/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/opt/mesosphere/zookeeper/ Bin
。。。。 Slightly....
Point is environment variable in effect
Source/etc/profile
Troubleshoot the problem:
Add zookeeper to configure the soft connection to resolve the problem of performing zkserver.sh error:
Ln-s/etc/zookeeper/conf//opt/mesosphere/zookeeper/
Do not add the secondary soft connection will error: The contents are as follows:
Using config:/opt/mesosphere/zookeeper/bin/. /etc/zookeeper/zoo.cfg
grep:/opt/mesosphere/zookeeper/bin/. /etc/zookeeper/zoo.cfg:no such file or directory
Mkdir:cannot Create directory ": No such file or directory
grep:/opt/mesosphere/zookeeper/bin/. /etc/zookeeper/zoo.cfg:no such file or directory
grep:/opt/mesosphere/zookeeper/bin/. /etc/zookeeper/zoo.cfg:no such file or directory
4: Verify
(1)
echo RUOK|NC 127.0.0.1 2181
Imok
(2) After the environment variable is added, enter ZK to press the TAB key to make up the corresponding command
zkserver.sh status
JMX enabled by default
Using Config:/etc/zookeeper/conf/zoo.cfg
Mode:follower
5: On-demand can synchronize the modified profile to the Zookeeper cluster other host, and then modify the ID information;
Transport environment variable file:
For IP in $ (cat/workspace/mesoslist);d o echo------$ip-----; rsync-avp/etc/profile [email protected] $ip:/etc/;d One
is the environment variable in effect, check the node status:
For IP in $ (cat/workspace/mesoslist);d o echo------$ip-----; ssh [email protected] $ip "Source/etc/profile && Zkse rver.sh status ";d one
To view the service listening port:
[Email protected] conf]# NETSTAT-TUNLP
Active Internet connections (only servers)
Proto recv-q send-q Local address Foreign address State Pid/program Name
TCP6 0 0::: 2181:::* LISTEN 12975/java
6: Modify Zookeeper output log file location
If you do not make changes, the default zookeeper log output information is printed to the Zookeeper.out file, so the output path and size cannot be controlled because the log file is not rotated. Therefore, you need to modify the log output mode. Here's how:
1, modify the zkenv.sh file in the $zookeeper_home/bin directory, zoo_log_dir specify which directory you want to output to, Zoo_log4j_prop, specify Info,rollingfile log Appender.
2. Create Log output folder
Mkdir-p/var/log/zookeeper
chmod 755/var/log/zookeeper
Vim +57/opt/mesosphere/zookeeper/bin/zkenv.sh
Then
# zoo_log_dir= "."
Zoo_log_dir= "/var/log/zookeeper" #指定想要输出到哪个目录
+ fi
59
if ["x${zoo_log4j_prop}" = "X"]
Then
zoo_log4j_prop= # "Info,console"
zoo_log4j_prop= "Info,rollingfile" #ROLLINGFILE的日志APPENDER.
+ fi
65
4. Modify the $zookeeper_home/conf/log4j.properties file: The value of Zookeeper.root.logger is consistent with the zoo_log4j_prop of the previous file, and the log configuration is rotated in the log file size , if you want to rotate by day, you can modify it to daliyrollingfileappender.
[Email protected] conf]# vim/etc/zookeeper/conf/log4j.properties
1 # Define Some default values that can is overridden by system properties
2 Zookeeper.root.logger=info, Rollingfile #值与前一个文件的ZOO_LOG4J_PROP
3 Zookeeper.console.threshold=info
..... Slightly......
49 #
# ADD Tracefile to Rootlogger to get log file output
Wuyi # Log DEBUG level and above messages to a log file
Appender.tracefile=org.apache.log4j.fileappender #log4j.
Log4j.appender.tracefile=org.apache.log4j.rollingfileappender #如果想要按照天轮转, can be modified to Daliyrollingfileappender
Log4j.appender.tracefile.threshold=trace
Log4j.appender.tracefile.file=${zookeeper.tracelog.dir}/${zookeeper.tracelog.file}
56
5, the configuration file modification completes, restarts the service;
Service Zookeeper restart
6, check the log, log output to the modified location:
[Email protected] conf]# Tailf/var/log/zookeeper/zookeeper.log
2016-03-22 16:27:23,704 [Myid:2]-INFO [quorumpeer[myid=2]/0:0:0:0:0:0:0:0:2181:[email protected]]-Server Environment:os.name=linux
2016-03-22 16:27:23,706 [Myid:2]-INFO [quorumpeer[myid=2]/0:0:0:0:0:0:0:0:2181:zookeeperse
7, the modified configuration file, you can copy to other nodes
SCP zkenv.sh 172.16.7.13:/opt/mesosphere/zookeeper/bin/
Scp/etc/zookeeper/conf/log4j.properties 172.16.7.13:/etc/zookeeper/conf/
###############################################################
Mesos Cluster add ZooKeeper information configuration
###############################################################
Need to configure zookeeper address, write into/ETC/MESOS/ZK, detailed as follows:
Cat << EOF >/ETC/MESOS/ZK
Zk://ctn-7-12.ptmind.com:2181,ctn-7-13.ptmind.com:2181,ctn-7-14.ptmind.com:2181/mesos
Eof
Configure Mesos-master To configure the nodes that need to be configured as master.
Mesos cluster installation Deployment planning, preparation (1)
Mesos cluster Installation Deployment Zookeeper (2)
Mesos cluster Installation Deployment Mesos-master (3)
Mesos cluster Installation Deployment Marathon (4)
Mesos cluster Installation Deployment Chronos (5)
Mesos cluster Installation Deployment Mesos-slave (6)
Mesos cluster Installation Deployment Mesos-dns (7)
Mesos cluster basic function test (8)
Mesos cluster Cleanup (9)
This article from "Kang Jianhua" blog, reproduced please contact the author!
Mesos cluster Installation Deployment Zookeeper (2)