废话不说直接上报错信息:
Starting zookeeper ... /usr/local/zookeeper/bin/zkServer.sh: 行 158: /usr/local/zookeeper/bin/../logs/zookeeper-hadoop-server-yjp.out: 权限不够
/usr/local/zookeeper/bin/zkServer.sh: 行 169: /usr/local/zookeeper/data/zookeeper_server.pid: 权限不够
FAILED TO WRITE PID
Starting zookeeper ... /usr/local/zookeeper/bin/zkServer.sh: 行 158: /usr/local/zookeeper/bin/../logs/zookeeper-hadoop-server-yjp.out: 权限不够
/usr/local/zookeeper/bin/zkServer.sh: 行 169: /usr/local/zookeeper/data/zookeeper_server.pid: 权限不够
FAILED TO WRITE PID
此类情况就是你在创建dataLogDir和dataDir目录时在root用户下创建了,目录所属用户默认为root
使用命令将data与logs目录所属用户改为要启动zookeeper的用户即可
chown -R hadoop data/
chown -R hadoop logs/
启动成功