Skip to content

Instantly share code, notes, and snippets.

@jieniu
Created January 22, 2017 05:50
Show Gist options
  • Save jieniu/981f4230e830d6db10800210378aef0c to your computer and use it in GitHub Desktop.
Save jieniu/981f4230e830d6db10800210378aef0c to your computer and use it in GitHub Desktop.
# 添加dev组为sudoer组
groupadd dev
chmod u+x /etc/sudoers
sed -i 's,wheel,dev,' /etc/sudoers
# 不允许root用户登录,一定要提前设置其他登录用户
sed -i 's,#PermitRootLogin yes,PermitRootLogin no,' /etc/ssh/sshd_config
service sshd restart
# zookeeper安装
tar xzvf zookeeper-3.4.9.tar.gz
mv zookeeper-3.4.9 /usr/local/zookeeper
chgrp -R dev /usr/local/zookeeper
sudo mv /usr/local/zookeeper/conf/zoo_sample.cfg /usr/local/zookeeper/conf/zoo.cfg
sudo echo "server.1=192.168.65.76:2888:3888" >> /usr/local/zookeeper/conf/zoo.cfg
sudo echo "server.2=192.168.65.77:2888:3888" >> /usr/local/zookeeper/conf/zoo.cfg
sudo echo "server.3=192.168.65.78:2888:3888" >> /usr/local/zookeeper/conf/zoo.cfg
mkdir /tmp/zookeeper
echo "1" >> /tmp/zookeeper/myid # 每台机器的id不一样
echo export PATH=$PATH:/usr/local/zookeeper/bin >> ~/.bashrc
. ~/.bashrc
# 修改iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 2888 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3888 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 2181 -j ACCEPT
# test
zkClient.sh -server 192.168.65.78/76/77:2181
create /zk_test my_data
get /zk_test
delete /zk_test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment