問題描述
安裝redis后, 啟動失敗
排查步驟記錄
0/查看啟動日志
13519:M 02 Jun 2020 16:47:53.070 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 13519:M 02 Jun 2020 16:47:53.070 # Server initialized 13519:M 02 Jun 2020 16:47:53.070 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. 13519:M 02 Jun 2020 16:47:53.070 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. 13519:M 02 Jun 2020 16:47:53.070 * DB loaded from disk: 0.000 seconds 13519:M 02 Jun 2020 16:47:53.070 * Ready to accept connections 13519:signal-handler (1591088608) Received SIGTERM scheduling shutdown... 13519:M 02 Jun 2020 17:03:28.561 # User requested shutdown... 13519:M 02 Jun 2020 17:03:28.561 * Saving the final RDB snapshot before exiting. 13519:M 02 Jun 2020 17:03:28.563 * DB saved on disk 13519:M 02 Jun 2020 17:03:28.563 * Removing the pid file. 13519:M 02 Jun 2020 17:03:28.563 # Redis is now ready to exit, bye bye... 13585:C 02 Jun 2020 17:04:00.422 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 13585:C 02 Jun 2020 17:04:00.422 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=13585, just started 13585:C 02 Jun 2020 17:04:00.422 # Configuration loaded 13586:M 02 Jun 2020 17:04:00.425 # Could not create server TCP listening socket 47.244.127.184:6379: bind: Cannot assign requested address 13586:M 02 Jun 2020 17:04:00.425 # Configured to not listen anywhere, exiting.
1/修改redis.conf
bind 127.0.0.1
bind 外網ip
啟動失敗, 忽然想起6379端口沒開
2/修改阿里雲服務器安全組, 開放6379端口
啟動依然失敗
3/再次修改redis.conf
經運維朋友提醒, 雲服務器有內網ip和外網ip, 然后再次修改redis.conf
bind 127.0.0.1
bind 雲服務器外網ip
bind 雲服務器內網ip
啟動成功, 遠程連接成功
4/最終測試結果
三個都得放開, 或者都注釋才實現遠程連接redis
至此結束, 有問題拍磚.