vim /etc/systemd/system/zookeeper.service

假设/data/zookeeper是它的安装目录

[Unit]
Description=Zookeeper
After=network.target

[Service]
Type=simple
#Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/bin/java/:/usr/java/jdk1.8.0_151/jre/bin"
Environment=ZOO_LOG_DIR=/data/zookeeper/logs
User=root
Group=root
ExecStart=/data/zookeeper/bin/zkServer.sh start
ExecStop=/data/zookeeper/bin/zkServer.sh stop
PIDFile=/data/zookeeper/data/zookeeper_server.pid
[Install]
WantedBy=multi-user.target

/data/zookeeper/bin/zkServer.sh status 查看状态

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐