주키퍼 설치 스크립트 본문
1. 자바 설치
#openjdk 1.8 다운로드
cd /install_files/
tar zxvf openjdk-8u41-b04-linux-x64-14_jan_2020.tar.gz
mv java-se-8u41-ri /usr/bin/
cd /usr/bin
ln -s /usr/bin/java-se-8u41-ri java
sudo vi /etc/profile
#환경변수 설정
export JAVA_HOME=/usr/bin/java
export PATH=$JAVA_HOME/bin:$PATH
#버전 확인
java -version
2. 주키퍼 설치
#설치파일 다운로드
cd /install_files/
wget http://apache.mirror.cdnetworks.com/zookeeper/stable/apache-zookeeper-3.6.2-bin.tar.gz
tar zxf apache-zookeeper-3.6.2-bin.tar.gz
mv apache-zookeeper-3.6.2-bin /usr/local/
ln -s /usr/local/apache-zookeeper-3.6.2-bin zookeeper
ls -la zookeeper
mkdir -p /data
echo 1 > /data/myid
cat /data/myid
#설정편집
vi /usr/local/zookeeper/conf/zoo.cfg
tickTime=2000 initLimit=10 syncLimit=5 dataDir=/data clientPort=2181 server.1=0.0.0.0:2888:3888 |
#서비스 시작 및 중지, 서비스 확인
/usr/local/zookeeper/bin/zkServer.sh start
/usr/local/zookeeper/bin/zkServer.sh status
/usr/local/zookeeper/bin/zkServer.sh stop
#systemd 등록
vi /etc/systemd/system/zookeeper-server.service
[Unit] Description=zookeeper-server.service After=network.target [Service] Type=forking User=root Group=root SyslogIdentifier=zookeeper-server WorkingDirectory=/usr/local/zookeeper Restart=always RestartSec=0s ExecStart=/usr/local/zookeeper/bin/zkServer.sh start ExecStop=/usr/local/zookeeper/bin/zkServer.sh stop |
#서비스 등록
systemctl daemon-reload
systemctl start zookeeper-server.service
systemctl enable zookeeper-server.service
systemctl status zookeeper-server.service
#리스닝 확인
netstat -ntlp | grep 2181
/usr/local/zookeeper/bin/zkCli.sh
ls /
'Kafka' 카테고리의 다른 글
카프카 설치 스크립트 (0) | 2021.05.20 |
---|