今天记录一下在我安装完pika后配置系统服务启动时遇到的一系列问题,安装pika及配置服务参考:Linux阿里云ECS中安装Pika及配置Pika为系统服务开机自启动Linux阿里云ECS中安装Pika及配置Pika为系统服务开机自启动,不止是pika,在你配置其它服务时可能也会遇到同样的问题,希望对大家有帮助,如果我的博客对你有帮助,欢迎进行评论✏️✏️、点赞👍👍、收藏⭐️⭐️,满足一下我的虚荣心💖🙏🙏🙏 。
目录
错误一:Job for pika.service failed because the control process exited with error code.See "systemctl status pika.service" and "journalctl -xe" for details.
错误2:pika.service: control process exited, code=killed status=6
错误一:Job for pika.service failed because the control process exited with error code.See "systemctl status pika.service" and "journalctl -xe" for details.
按照错误提示,我们执行如下命令看一下 systemctl status pika.service 中的内容,如下:
systemctl status pika.service
如上,我这里首先发现的错误是,我的pika路径错误了,我是按照我博客上直接复制的,改成自己真实的路径后再试一下,注意:修改pika.service文件后,要先重新加载一下这个配置文件,执行如下命令:
systemctl daemon-reload
如果不执行上述命令,控制台还是会报上面的错并提醒:
Warning: pika.service changed on disk. Run 'systemctl daemon-reload' to reload units.
错误2:pika.service: control process exited, code=killed status=6
上面我改完路径启动时还是包上面的错误:Job for pika.service failed because the control process exited with error code.See "systemctl status pika.service" and "journalctl -xe" for details.
通过执行 ystemctl status pika.service 发现错误:pika.service: control process exited, code=killed status=6 ,完整信息如下:
● pika.service - pika server
Loaded: loaded (/usr/lib/systemd/system/pika.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Fri 2022-09-16 11:16:10 CST; 4s ago
Process: 17724 ExecStart=/db/output/bin/pika -c /db/output/conf/pika.conf (code=killed, signal=ABRT)Sep 16 11:16:09 iZ0jlgushn24yfo systemd[1]: pika.service: control process exited, code=killed status=6
Sep 16 11:16:09 iZ0jlgushn24yfo systemd[1]: Failed to start pika server.
Sep 16 11:16:09 iZ0jlgushn24yfo systemd[1]: Unit pika.service entered failed state.
Sep 16 11:16:09 iZ0jlgushn24yfo systemd[1]: pika.service failed.
Sep 16 11:16:10 iZ0jlgushn24yfo systemd[1]: pika.service holdoff time over, scheduling restart.
Sep 16 11:16:10 iZ0jlgushn24yfo systemd[1]: Stopped pika server.
Sep 16 11:16:10 iZ0jlgushn24yfo systemd[1]: start request repeated too quickly for pika.service
Sep 16 11:16:10 iZ0jlgushn24yfo systemd[1]: Failed to start pika server.
Sep 16 11:16:10 iZ0jlgushn24yfo systemd[1]: Unit pika.service entered failed state.
Sep 16 11:16:10 iZ0jlgushn24yfo systemd[1]: pika.service failed.
使用如下命令查看更详细的信息:
journalctl -u pika
有如下一段信息:
Sep 16 11:16:04 iZ0jlgushn24yfo systemd[1]: pika.service: control process exited, code=killed status=6
Sep 16 11:16:04 iZ0jlgushn24yfo systemd[1]: Failed to start pika server.
Sep 16 11:16:04 iZ0jlgushn24yfo systemd[1]: Unit pika.service entered failed state.
Sep 16 11:16:04 iZ0jlgushn24yfo systemd[1]: pika.service failed.
Sep 16 11:16:05 iZ0jlgushn24yfo systemd[1]: pika.service holdoff time over, scheduling restart.
Sep 16 11:16:05 iZ0jlgushn24yfo systemd[1]: Stopped pika server.
Sep 16 11:16:05 iZ0jlgushn24yfo systemd[1]: Starting pika server...
Sep 16 11:16:05 iZ0jlgushn24yfo pika[17658]: WARNING: Logging before InitGoogleLogging() is written to STDERR
Sep 16 11:16:05 iZ0jlgushn24yfo pika[17658]: W0916 11:16:05.117300 17658 pika.cc:171] your 'limit -n ' of 1024 is not enough for Redis to start. pika have successfully reconfig it to 25000
Sep 16 11:16:05 iZ0jlgushn24yfo pika[17658]: I0916 11:16:05.117364 17658 pika.cc:187] Server at: /db/output/conf/pika.conf
Sep 16 11:16:05 iZ0jlgushn24yfo pika[17658]: I0916 11:16:05.117679 17658 pika_server.cc:167] Using Networker Interface: eth0
Sep 16 11:16:05 iZ0jlgushn24yfo pika[17658]: I0916 11:16:05.117743 17658 pika_server.cc:210] host: 172.16.0.78 port: 9221
Sep 16 11:16:05 iZ0jlgushn24yfo pika[17658]: I0916 11:16:05.117753 17658 pika_server.cc:87] Worker queue limit is 2600
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: W0916 11:16:06.122175 17658 pika_rsync_service.cc:61] Rsync service is no live, path:./dbsync/
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: F0916 11:16:06.122246 17658 pika_server.cc:220] Start Rsync Error: bind port 10221 failed, Listen on this port to receive Master FullSync Data
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: *** Check failure stack trace: ***
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: @ 0x93964a google::LogMessage::Fail()
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: @ 0x93b38f google::LogMessage::SendToLog()
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: @ 0x939298 google::LogMessage::Flush()
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: @ 0x93bcbe google::LogMessageFatal::~LogMessageFatal()
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: @ 0x4b9a49 PikaServer::Start()
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: @ 0x43f0ce main
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: @ 0x7ff44b3bf555 __libc_start_main
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: @ 0x414909 (unknown)
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: path : /db/output/conf/pika.conf
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: -----------Pika server 3.2.8 ----------
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: -----------Pika config list----------
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 1 port 9221
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 2 thread-num 8
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 3 thread-pool-size 12
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 4 sync-thread-num 6
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 5 log-path ./log/
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 6 db-path ./db/
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 7 write-buffer-size 1073741824
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 8 timeout 60
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 9 requirepass
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 10 masterauth
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 11 userpass
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 12 userblacklist
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 13 instance-mode classic
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 14 databases 1
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 15 default-slot-num 1024
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 16 dump-prefix
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 17 dump-path ./dump/
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 18 dump-expire 0
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 19 pidfile ./pika.pid
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 20 maxclients 20000
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 21 target-file-size-base 20971520
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 22 expire-logs-days 7
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 23 expire-logs-nums 10
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 24 root-connection-num 2
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 25 slowlog-write-errorlog no
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 26 slowlog-log-slower-than 10000
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 27 slowlog-max-len 128
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 28 db-sync-path ./dbsync/
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 29 db-sync-speed -1
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 30 slave-priority 100
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 31 server-id 1
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 32 sync-window-size 9000
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 33 max-conn-rbuf-size 268435456
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 34 write-binlog no
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 35 binlog-file-size 104857600
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 36 max-cache-statistic-keys 0
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 37 small-compaction-threshold 5000
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 38 max-write-buffer-size 10737418240
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 39 max-client-response-size 1073741824
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 40 compression snappy
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 41 max-background-flushes 1
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 42 max-background-compactions 2
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 43 max-cache-files 5000
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: 44 max-bytes-for-level-multiplier 10
Sep 16 11:16:06 iZ0jlgushn24yfo pika[17658]: -----------Pika config end----------
以上有一条信息:Start Rsync Error: bind port 10221 failed, Listen on this port to receive Master FullSync Data ,这个端口启动的时候绑定失败,于是我看了下这个端口被哪个程序占用,如下:
netstat -tnlp | grep :10221
kill -9 12793
于是我将占用10221端口的进程kill掉,再次启动就正常启动了。