Cassandra3在Centos7下启动失败解决办法

Centos7 安装Cassandra启动过程提示失败,查看结果如下所示:

[root@xx ~]# systemctl status cassandra
● cassandra.service - LSB: distributed storage system for structured data
Loaded: loaded (/etc/rc.d/init.d/cassandra; bad; vendor preset: disabled)
Active: failed (Result: resources) since 一 2019-11-25 21:19:48 CST; 9s ago
Docs: man:systemd-sysv-generator(8)
Process: 13112 ExecStart=/etc/rc.d/init.d/cassandra start (code=exited, status=0/SUCCESS)

11月 25 21:19:48 iZuf61rbucjm1exafe5h9hZ systemd[1]: Starting LSB: distributed storage system for structured data...
11月 25 21:19:48 iZuf61rbucjm1exafe5h9hZ su[13122]: (to cassandra) root on none
11月 25 21:19:48 iZuf61rbucjm1exafe5h9hZ cassandra[13112]: Starting Cassandra: OK
11月 25 21:19:48 iZuf61rbucjm1exafe5h9hZ systemd[1]: New main PID 13196 does not belong to service, and PID file is ...ing.
11月 25 21:19:48 iZuf61rbucjm1exafe5h9hZ systemd[1]: New main PID 13196 does not belong to service, and PID file is ...ing.
11月 25 21:19:48 iZuf61rbucjm1exafe5h9hZ systemd[1]: Failed to start LSB: distributed storage system for structured data.
11月 25 21:19:48 iZuf61rbucjm1exafe5h9hZ systemd[1]: Unit cassandra.service entered failed state.
11月 25 21:19:48 iZuf61rbucjm1exafe5h9hZ systemd[1]: cassandra.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

通过网上查找资料发现Cassandra没有cassandra.service 文件,只能通过自己创建方式进行。参考:https://askubuntu.com/questions/836059/sudo-service-status-includes-bad

以下为我的参考示例:

[Unit]
Description=Apache Cassandra
After=network.target

[Service]
PIDFile=/var/run/cassandra/cassandra.pid
User=cassandra
Group=cassandra
ExecStart=/usr/sbin/cassandra -f -p /var/run/cassandra/cassandra.pid
Restart=always

[Install]
WantedBy=multi-user.target

写入/etc/systemd/system/cassandra.service 和/usr/lib/systemd/system/cassandra.service

稍后执行:systemctl enable cassandra 之后即可用systemctl启动

[root@xxx ~]# systemctl start cassandra
[root@xxx ~]# ps -ef | grep cassan
cassand+ 1591 1 0 12:55 ? 00:01:59 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/jre/bin/java -Xloggc:/var/log/cassandra/gc.log -ea -XX:+UseThreadPriorities -XX:ThreadPriorityPoli

posted @ 2019-11-25 21:46  小 伍  阅读(2784)  评论(0编辑  收藏  举报