{"id":78594,"date":"2023-09-20T17:53:03","date_gmt":"2023-09-20T09:53:03","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=78594"},"modified":"2023-09-20T17:53:03","modified_gmt":"2023-09-20T09:53:03","slug":"redis-install-conf2","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/redis-install-conf2.html","title":{"rendered":"\u5355\u5b9e\u4f8bredis \u7684\u5b89\u88c5\u914d\u7f6e\uff08\u4e0b\uff09"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nRedis\u662f\u4e00\u79cd\u9ad8\u7ea7key-value\u6570\u636e\u5e93\u3002\u5b83\u8ddfmemcached\u7c7b\u4f3c\uff0c\u4e0d\u8fc7\u6570\u636e\u53ef\u4ee5\u6301\u4e45\u5316\uff0c\u800c\u4e14\u652f\u6301\u7684\u6570\u636e\u7c7b\u578b\u5f88\u4e30\u5bcc\u3002\u5728\u8fd0\u7ef4\u7684\u5de5\u4f5c\u4e2d\uff0c\u7f13\u5b58\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u6280\u672f\uff0c\u9759\u6001\u6587\u4ef6\u7684\u7f13\u5b58\u6211\u4eec\u6709\uff1anginx\u7684\u7f13\u5b58\uff0csquid\u7684\u7f13\u5b58\u7b49\uff0c\u6570\u636e\u5e93\u7684\u7f13\u5b58\u6211\u4eec\u6709redis\u548cmemcache\u7b49\uff0c\u751a\u81f3\u6709\u4e9b\u516c\u53f8\u4f1a\u9009\u62e9\u505aredis\u7684\u96c6\u7fa4\u3002\u4e0a\u6b21\u6211\u4eec\u8bb2\u4e86redis\u7684\u7f13\u5b58\u7684\u5b89\u88c5\u548c\u7b80\u5355\u7684\u914d\u7f6e\u4e0a\uff0c\u73b0\u5728\u6211\u4eec\u6765\u770b\u4e0bredis\u7684\u914d\u7f6e\u548c\u540e\u671f\u7684\u538b\u6d4b<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u6dfb\u52a0redis \u76f8\u5173\u547d\u4ee4<\/strong><\/div>\n
Redis \u7684\u8fd0\u884c\u6a21\u5f0f\u5bf9\u6bd4<\/strong><\/span><\/div>\n

\u5728Linux\u7cfb\u7edf\u8fdb\u884cmake\u540e\uff0c\u6211\u4eec\u5176\u5b9e\u662f\u53ef\u4ee5\u76f4\u63a5\u8fdb\u5165\u5b89\u88c5\u5305\u7684\"\/usr\/local\/src\/redis-3.2.9\/src\"\u76f4\u63a5\u8fd0\u884credis\u7684\uff0c\u8fd9\u79cd\u5462\u662f\u4e00\u79cd\u975e\u7cfb\u7edf\u5b88\u62a4\u8fdb\u7a0b\u7684\u6a21\u5f0f\u8fd0\u884c\u7684\uff1a<\/p>\n

[root@zbbix redis-3.2.9]# ls\r\n00-RELEASENOTES  BUGS  CONTRIBUTING  COPYING  deps  INSTALL  Makefile  MANIFESTO  README.md  redis.conf  runtest  runtest-cluster  runtest-sentinel  sentinel.conf  src  tests  utils\r\n[root@zbbix redis-3.2.9]# pwd\r\n\/usr\/local\/src\/redis-3.2.9\r\n[root@zbbix redis-3.2.9]# src\/redis-server \r\n9795:C 11 Jul 23:34:09.872 # Warning: no config file specified, using the default config. In order to specify a config file use src\/redis-server \/path\/to\/redis.conf\r\n9795:M 11 Jul 23:34:09.875 * Increased maximum number of open files to 10032 (it was originally set to 1024).\r\n                _._                                                  \r\n           _.-``__ ''-._                                             \r\n      _.-``    `.  `_.  ''-._           Redis 3.2.9 (00000000\/0) 64 bit\r\n  .-`` .-```.  ```\\\/    _.,_ ''-._                                   \r\n (    '      ,       .-`  | `,    )     Running in standalone mode\r\n |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379\r\n |    `-._   `._    \/     _.-'    |     PID: 9795\r\n  `-._    `-._  `-.\/  _.-'    _.-'                                   \r\n |`-._`-._    `-.__.-'    _.-'_.-'|                                  \r\n |    `-._`-._        _.-'_.-'    |           http:\/\/redis.io        \r\n  `-._    `-._`-.__.-'_.-'    _.-'                                   \r\n |`-._`-._    `-.__.-'    _.-'_.-'|                                  \r\n |    `-._`-._        _.-'_.-'    |                                  \r\n  `-._    `-._`-.__.-'_.-'    _.-'                                   \r\n      `-._    `-.__.-'    _.-'                                       \r\n          `-._        _.-'                                           \r\n              `-.__.-'                                               \r\n\r\n9795:M 11 Jul 23:34:09.883 # WARNING: The TCP backlog setting of 511 cannot be enforced because \/proc\/sys\/net\/core\/somaxconn is set to the lower value of 128.\r\n9795:M 11 Jul 23:34:09.884 # Server started, Redis version 3.2.9\r\n9795:M 11 Jul 23:34:09.884 # 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.\r\n9795:M 11 Jul 23:34:09.891 # 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.\r\n9795:M 11 Jul 23:34:09.891 * The server is now ready to accept connections on port 6379\r\n\r\n\r\n\r\n\r\n^C9795:signal-handler (1499787252) Received SIGINT scheduling shutdown...\r\n9795:M 11 Jul 23:34:12.419 # User requested shutdown...\r\n9795:M 11 Jul 23:34:12.419 * Saving the final RDB snapshot before exiting.\r\n9795:M 11 Jul 23:34:12.481 * DB saved on disk\r\n9795:M 11 Jul 23:34:12.481 # Redis is now ready to exit, bye bye...\r\n<\/pre>\n

\u6211\u4eec\u53d1\u73b0\u8fd9\u79cd\u6a21\u5f0f\u4e0b\u6211\u4eec\u4e0d\u80fd\u9000\u51fa\u8fd9\u4e2a\u754c\u9762\uff0c\u5f53\u6211\u4eec\u6309ctrl+c\u7684\u65f6\u5019\uff0credis\u670d\u52a1\u4e5f\u8ddf\u7740\u505c\u6b62\u4e86\u3002\u6211\u4eec\u5c1d\u8bd5\u4ee5\u540e\u53f0\u8fdb\u7a0b\u7684\u5f62\u5f0f\u8fdb\u884c\uff1a<\/p><\/blockquote>\n

[root@zbbix redis-3.2.9]# src\/redis-server &\r\n[1] 9798\r\n[root@zbbix redis-3.2.9]# 9798:C 11 Jul 23:34:17.785 # Warning: no config file specified, using the default config. In order to specify a config file use src\/redis-server \/path\/to\/redis.conf\r\n9798:M 11 Jul 23:34:17.786 * Increased maximum number of open files to 10032 (it was originally set to 1024).\r\n                _._                                                  \r\n           _.-``__ ''-._                                             \r\n      _.-``    `.  `_.  ''-._           Redis 3.2.9 (00000000\/0) 64 bit\r\n  .-`` .-```.  ```\\\/    _.,_ ''-._                                   \r\n (    '      ,       .-`  | `,    )     Running in standalone mode\r\n |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379\r\n |    `-._   `._    \/     _.-'    |     PID: 9798\r\n  `-._    `-._  `-.\/  _.-'    _.-'                                   \r\n |`-._`-._    `-.__.-'    _.-'_.-'|                                  \r\n |    `-._`-._        _.-'_.-'    |           http:\/\/redis.io        \r\n  `-._    `-._`-.__.-'_.-'    _.-'                                   \r\n |`-._`-._    `-.__.-'    _.-'_.-'|                                  \r\n |    `-._`-._        _.-'_.-'    |                                  \r\n  `-._    `-._`-.__.-'_.-'    _.-'                                   \r\n      `-._    `-.__.-'    _.-'                                       \r\n          `-._        _.-'                                           \r\n              `-.__.-'                                               \r\n\r\n9798:M 11 Jul 23:34:17.788 # WARNING: The TCP backlog setting of 511 cannot be enforced because \/proc\/sys\/net\/core\/somaxconn is set to the lower value of 128.\r\n9798:M 11 Jul 23:34:17.788 # Server started, Redis version 3.2.9\r\n9798:M 11 Jul 23:34:17.788 # 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.\r\n9798:M 11 Jul 23:34:17.788 # 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.\r\n9798:M 11 Jul 23:34:17.789 * DB loaded from disk: 0.001 seconds\r\n9798:M 11 Jul 23:34:17.789 * The server is now ready to accept connections on port 6379\r\n\r\n[root@zabbix redis-3.2.9]# \r\n[root@zabbix redis-3.2.9]# \r\n[root@zabbix redis-3.2.9]# \r\n[root@zabbix redis-3.2.9]# \r\n[root@zabbix redis-3.2.9]# \r\n[root@zabbix redis-3.2.9]# \r\n[root@zabbix redis-3.2.9]# src\/redis-cli \r\n127.0.0.1:6379> \r\n\r\n127.0.0.1:6379> info [section]\r\n\r\n127.0.0.1:6379> info\r\n\r\n# Server\r\n\r\nredis_version:3.2.9\r\n\r\nredis_git_sha1:00000000\r\n\r\nredis_git_dirty:0\r\n\r\nredis_build_id:a2c99427c4076cd4\r\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n\r\n<\/pre>\n

\u540e\u53f0\u8fdb\u7a0b\u662fok\u7684\uff0c\u6211\u4eec\u53ef\u4ee5\u6b63\u5e38\u64cd\u4f5c\uff0c\u4f46\u662f\u5bf9\u4e8e\u8fdb\u7a0b\u7684\u7ba1\u7406\u6211\u4eec\u53ea\u80fd\u901a\u8fc7\"ps -ef |grep redis |grep -v redis |awk '{print$1}' | xargs kill -9\" \u6765\u8fdb\u7a0b\u7ed3\u675fredis\u8fdb\u7a0b\uff0c\u901a\u8fc7\"\/usr\/local\/src\/redis-3.2.9\/src\/src\/redis-server &\"\u6765\u542f\u52a8\u8fdb\u7a0b\uff0c\u8fd9\u6837\u5e76\u4e0d\u662f\u592a\u65b9\u4fbf\u3002\u4e8e\u662f\u6709\u4e86\u6211\u4eec\u5b89\u88c5redis\u5e76\u4ee5\u5b88\u62a4\u8fdb\u7a0b\u7684\u65b9\u5f0f\u8fd0\u884c\u3002\u7531\u4e8e\u6211\u4eec\u5236\u5b9a\u4e86\u6211\u4eecredis\u7684\u5b89\u88c5\u4f4d\u7f6e\uff0c\u6211\u4eec\u7684redis\u547d\u4ee4\u7684\u4f4d\u7f6e\u4e5f\u6ca1\u6709\u5728\u6211\u4eec\u7684\u7cfb\u7edf\u53d8\u91cf\u4e2d\uff0c\u6211\u4eec\u4fee\u6539\u7cfb\u7edf\u53d8\u91cf\u3002<\/p><\/blockquote>\n

\u6dfb\u52a0redis\u547d\u4ee4\u7684\u7cfb\u7edf\u53d8\u91cf<\/strong><\/span><\/div>\n
#echo \"export PATH=$PATH:\/usr\/local\/redis\/bin >>\/etc\/profile              \\\\\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\r\n#tail -n 1 \/etc\/profile                                                   \\\\\u68c0\u67e5\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\r\nexport \tPATH=$PATH:\/usr\/local\/redis\/bin\r\n\r\n\u91cd\u65b0\u52a0\u8f7d\u73af\u5883\u53d8\u91cf:\r\n#source \/etc\/profile                                            \r\n\u68c0\u67e5redis\u547d\u4ee4---\r\n# redis-\r\nredis-benchmark  redis-check-aof  redis-check-rdb  redis-cli        redis-sentinel   redis-server  \r\n######reidis \u73af\u5883\u53d8\u91cf\u6dfb\u52a0\u5b8c\u6210\r\n<\/pre>\n
redis \u547d\u4ee4\u542b\u4e49<\/strong><\/div>\n
redis-server\uff1aRedis\u670d\u52a1\u5668\u7684daemon\u542f\u52a8\u7a0b\u5e8f\r\nredis-cli\uff1aRedis\u547d\u4ee4\u884c\u64cd\u4f5c\u5de5\u5177\u3002\u4e5f\u53ef\u4ee5\u7528telnet\u6839\u636e\u5176\u7eaf\u6587\u672c\u534f\u8bae\u6765\u64cd\u4f5c\r\nredis-benchmark\uff1aRedis\u6027\u80fd\u6d4b\u8bd5\u5de5\u5177\uff0c\u6d4b\u8bd5Redis\u5728\u5f53\u524d\u7cfb\u7edf\u4e0b\u7684\u8bfb\u5199\u6027\u80fd\r\nredis-check-aof\uff1a\u6570\u636e\u4fee\u590d\r\nredis-check-dump\uff1a\u68c0\u67e5\u5bfc\u51fa\u5de5\u5177\r\n<\/pre>\n
Redis \u542f\u52a8<\/strong><\/div>\n
[root@zabbix etc]# service redis start\r\nStarting Redis server...\r\n[root@zabbix etc]# lsof -i:6379\r\nCOMMAND    PID USER   FD   TYPE DEVICE SIZE\/OFF NODE NAME\r\nredis-ser 9625 root    4u  IPv4  49878      0t0  TCP *:6379 (LISTEN)\r\n[root@zabbix etc]# \r\n[root@zabbix etc]# \r\n[root@zabbix etc]# ps -ef |grep redis\r\nroot       9625      1  0 23:27 ?        00:00:00 \/usr\/local\/redis\/bin\/redis-server 0.0.0.0:6379                   \r\nroot       9630   4171  0 23:28 pts\/1    00:00:00 grep redis\r\n\r\n[root@zbbix redis-3.2.9]# src\/redis-cli \r\n127.0.0.1:6379> \r\n\r\n127.0.0.1:6379> info [section]\r\n\r\n127.0.0.1:6379> info\r\n\r\n# Server\r\n\r\nredis_version:3.2.9\r\n\r\nredis_git_sha1:00000000\r\n\r\nredis_git_dirty:0\r\n\r\nredis_build_id:a2c99427c4076cd4\r\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\nPS\uff1a\u5982\u679c\u542f\u7528\u4e86\u5bc6\u7801\u9a8c\u8bc1\uff0c\u5728cli\u4e2d\u9700\u8981\u5148\u6dfb\u52a0auth mima \u7136\u540e\u624d\u80fd\u64cd\u4f5c\u547d\u4ee4\r\n<\/pre>\n
\u68c0\u67e5redis\u670d\u52a1\u542f\u52a8<\/strong><\/span><\/div>\n
ps -ef |grep redis\r\nlsof -i:6379\r\nnetstat -tanlp |grep 6379\r\n<\/pre>\n
\u67e5\u770bredis \u7684\u7cfb\u7edf\u65e5\u5fd7\uff1a<\/strong><\/span><\/div>\n
tail -f \/usr\/local\/redis\/redis.log\r\n9766:M 11 Jul 23:32:38.320 # 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.\r\n9766:M 11 Jul 23:32:38.320 # 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.\r\n9766:M 11 Jul 23:32:38.321 * DB loaded from disk: 0.000 seconds\r\n9766:M 11 Jul 23:32:38.321 * The server is now ready to accept connections on port 6379\r\n9766:M 11 Jul 23:32:38.321 - 0 clients connected (0 slaves), 759680 bytes in use\r\n9766:M 11 Jul 23:32:43.363 - 0 clients connected (0 slaves), 759680 bytes in use\r\nXXXXX\r\n<\/pre>\n
redis \u670d\u52a1\u5668\u5185\u6838\u8c03\u4f18\uff1a<\/strong><\/div>\n
\u6cd5\u4e00\uff1a\r\na) echo vm.overcommit_memory=1 >> \/etc\/sysctl.conf\r\n\r\n\u6cd5\u4e8c\uff1a\r\nb) sysctl vm.overcommit_memory=1 \u6216\u6267\u884c\r\necho vm.overcommit_memory=1 >>\/proc\/sys\/vm\/overcommit_memory\r\n\r\n<\/pre>\n

\u5185\u6838vm.overcommit_memory\u6570\u5b57\u542b\u4e49\uff1a<\/p>\n

0\uff0c\u8868\u793a\u5185\u6838\u5c06\u68c0\u67e5\u662f\u5426\u6709\u8db3\u591f\u7684\u53ef\u7528\u5185\u5b58\u4f9b\u5e94\u7528\u8fdb\u7a0b\u4f7f\u7528\uff1b\u5982\u679c\u6709\u8db3\u591f\u7684\u53ef\u7528\u5185\u5b58\uff0c\u5185\u5b58\u7533\u8bf7\u5141\u8bb8\uff1b\u5426\u5219\uff0c\u5185\u5b58\u7533\u8bf7\u5931\u8d25\uff0c\u5e76\u628a\u9519\u8bef\u8fd4\u56de\u7ed9\u5e94\u7528\u8fdb\u7a0b\u3002<\/p>\n

1\uff0c\u8868\u793a\u5185\u6838\u5141\u8bb8\u5206\u914d\u6240\u6709\u7684\u7269\u7406\u5185\u5b58\uff0c\u800c\u4e0d\u7ba1\u5f53\u524d\u7684\u5185\u5b58\u72b6\u6001\u5982\u4f55\u3002<\/p>\n

2\uff0c\u8868\u793a\u5185\u6838\u5141\u8bb8\u5206\u914d\u8d85\u8fc7\u6240\u6709\u7269\u7406\u5185\u5b58\u548c\u4ea4\u6362\u7a7a\u95f4\u603b\u548c\u7684\u5185\u5b58<\/p><\/blockquote>\n

reids\u7cfb\u7edf\u538b\u529b\u6d4b\u8bd5\u5de5\u5177<\/strong><\/div>\n

redis \u81ea\u5e26\u6709\u81ea\u5df1\u7684\u538b\u529b\u6d4b\u8bd5\u5de5\u5177\uff0c\u5728redis\u4e0a\u751f\u4ea7\u73af\u5883\u7684\u65f6\u5019\u4e00\u5b9a\u8981\u786e\u5b9aredis\u7684\u6027\u80fd\u3002\u4e0b\u9762\u662f\u4f7f\u7528redis-benchmark\u7684\u5b9e\u4f8b(\u6765\u7740\u4e92\u8054\u7f51)\uff1a<\/p>\n

Redis-benchmark\u4f7f\u7528\u5b9e\u4f8b\uff1a<\/strong><\/span><\/div>\n

1\u3001redis-benchmark -h 192.168.1.201 -p 6379 -c 100 -n 100000
\n100\u4e2a\u5e76\u53d1\u8fde\u63a5\uff0c100000\u4e2a\u8bf7\u6c42\uff0c\u68c0\u6d4bhost\u4e3alocalhost \u7aef\u53e3\u4e3a6379\u7684redis\u670d\u52a1\u5668\u6027\u80fd<\/p>\n

2\u3001redis-benchmark -h 192.168.1.201 -p 6379 -q -d 100
\n\u6d4b\u8bd5\u5b58\u53d6\u5927\u5c0f\u4e3a100\u5b57\u8282\u7684\u6570\u636e\u5305\u7684\u6027\u80fd<\/p>\n

3\u3001redis-benchmark -t set,lpush -n 100000 -q
\n\u53ea\u6d4b\u8bd5\u67d0\u4e9b\u64cd\u4f5c\u7684\u6027\u80fd<\/p>\n

4\u3001redis-benchmark -n 100000 -q script load \"redis.call('set','foo','bar')\"
\n\u53ea\u6d4b\u8bd5\u67d0\u4e9b\u6570\u503c\u5b58\u53d6\u7684\u6027\u80fd<\/p><\/blockquote>\n

root@iZwz94wvtlc4lisg3mgkweZ:\/usr\/local\/redis-3.2.9\/utils# redis-benchmark -c 100 -n 100000\r\n====== PING_INLINE ======\r\n  100000 requests completed in 1.29 seconds\r\n  100 parallel clients\r\n  3 bytes payload\r\n  keep alive: 1\r\n\r\n80.86% <= 1 milliseconds\r\n99.83% <= 2 milliseconds\r\n99.95% <= 3 milliseconds\r\n100.00% <= 3 milliseconds\r\n77639.75 requests per second\r\n\r\n====== PING_BULK ======\r\n  100000 requests completed in 1.33 seconds\r\n  100 parallel clients\r\n  3 bytes payload\r\n  keep alive: 1\r\n\r\n79.37% <= 1 milliseconds\r\n99.84% <= 2 milliseconds\r\n99.93% <= 3 milliseconds\r\n100.00% <= 3 milliseconds\r\n75414.78 requests per second\r\n\r\n====== SET ======\r\n  100000 requests completed in 1.28 seconds\r\n  100 parallel clients\r\n  3 bytes payload\r\n  keep alive: 1\r\n\r\n81.20% <= 1 milliseconds\r\n99.85% <= 2 milliseconds\r\n99.92% <= 3 milliseconds\r\n100.00% <= 3 milliseconds\r\n77942.32 requests per second\r\n\r\n====== GET ======\r\n  100000 requests completed in 1.29 seconds\r\n  100 parallel clients\r\n  3 bytes payload\r\n  keep alive: 1\r\n\r\n80.94% <= 1 milliseconds\r\n99.90% <= 2 milliseconds\r\n99.99% <= 3 milliseconds\r\n100.00% <= 3 milliseconds\r\n77459.34 requests per second\r\n\r\n====== INCR ======\r\n  100000 requests completed in 1.28 seconds\r\n  100 parallel clients\r\n  3 bytes payload\r\n  keep alive: 1\r\n\r\n81.77% <= 1 milliseconds\r\n99.79% <= 2 milliseconds\r\n99.92% <= 3 milliseconds\r\n99.97% <= 4 milliseconds\r\n100.00% <= 4 milliseconds\r\n78308.54 requests per second\r\nxxxxxxxxxxxxxxxx\r\n\r\n\u6211\u4eec\u770b\u523070000 \u591a\u7684\u5cf0\u503c    5s\u5de6\u53f3\r\n<\/pre>\n
\u68c0\u67e5redis\u91cd\u542f\u52a8\u811a\u672c<\/strong><\/div>\n

\u7ecf\u8fc7\u4ee5\u4e0a\u7684\u64cd\u4f5c\u6211\u4eec\u7684redis\u670d\u52a1\u5e94\u8be5\u5df2\u7ecf\u914d\u7f6e\u5dee\u4e0d\u591a\u4e86\uff0c\u4f46\u662f\u6211\u4eec\u8981\u6709\u4e00\u4e2a\u68c0\u6d4b\u673a\u5236\u6765\u786e\u5b9aredis\u670d\u52a1\u7684\u6b63\u5e38\u8fd0\u884c\u3002\u5728\u8fd9\u91cc\u5462\u6211\u4eec\u5199\u4e86\u4e00\u4e2a\u811a\u672c\u6765\u68c0\u6d4b\u6211\u4eec\u7684redis\u670d\u52a1\uff0c\u5982\u679c\u670d\u52a1\u51fa\u73b0\u95ee\u9898\uff0c\u6211\u4eec\u5219\u91cd\u542fredis\u670d\u52a1\u3002\uff08\u4e0d\u5efa\u8bae\uff0c\u5efa\u8bae\u4f7f\u7528\u76d1\u63a7\u7cfb\u7edf\u4e86\u9884\u8b66redis\u670d\u52a1\uff01\uff01\uff01\uff09<\/p>\n

\u68c0\u6d4b\u811a\u672c\u5185\u5bb9<\/strong><\/span><\/div>\n

cat check-redis-restart.sh<\/p>\n

#!\/bin\/sh\r\n#this is check redis and restart redis \r\n\r\nlsof -i:6379 |grep LISTEN >> \/tmp\/reids-status.log\r\n\r\nif [ $? -eq 1 ]; then \r\n\techo \"`date` redis is down,restart it \" >> \/usr\/local\/redis\/redis-check-error.log\r\n\trm -rf \/var\/run\/redis.pid >> \/usr\/local\/redis\/redis-check-error.log\r\n\t\/etc\/init.d\/redis stop >> \/usr\/local\/redis\/redis-check-error.log\r\n\t\/etc\/init.d\/redis start >> \/usr\/local\/redis\/redis-check-error.log\r\nfi\r\n\r\n<\/pre>\n
\u5c06\u811a\u672c\u6dfb\u52a0\u5230crontab\u4efb\u52a1\u4e2d1\u5206\u949f\u6267\u884c\u4e00\u6b21<\/strong><\/span><\/div>\n
crontab -e\r\n* * * * * cd \/usr\/local\/redis\/bin\/ && .\/check-redis-restart.sh >> \/usr\/local\/redis\/edis-check-error.log 2>&1 \r\n<\/pre>\n

\u91cd\u542fcrontab\u670d\u52a1\uff1a<\/p>\n

service cron restart\r\nchkconfig cron on\r\n<\/pre>\n

\u68c0\u67e5\u91cd\u542fredis\u65e5\u5fd7\uff1a<\/p>\n

tail -f \/tmp\/reids-status.log\r\ntail -f \/usr\/local\/redis\/redis-check-error.log\r\n<\/pre>\n
\n

\u672c\u6587\u539f\u521b\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/redis-install-conf2.html<\/a>\u4f5c\u8005\uff1a\u9676\u6b66\u6770\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb Redis\u662f\u4e00\u79cd\u9ad8\u7ea7key-value\u6570\u636e\u5e93\u3002\u5b83\u8ddfmemcached\u7c7b\u4f3c\uff0c\u4e0d\u8fc7\u6570\u636e\u53ef\u4ee5\u6301\u4e45\u5316\uff0c\u800c\u4e14\u652f\u6301\u7684 […]<\/p>\n","protected":false},"author":63,"featured_media":78596,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-78594","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/78594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=78594"}],"version-history":[{"count":11,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/78594\/revisions"}],"predecessor-version":[{"id":78738,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/78594\/revisions\/78738"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/78596"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=78594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=78594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=78594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}