redis如何重新啟動?
#正常啟動指令:
redis-server # 启动redis服务端 [1709] 28 Feb 06:45:08.346 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf [1709] 28 Feb 06:45:08.348 * Max number of open files set to 10032 _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 2.8.4 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in stand alone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 1709 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' [1709] 28 Feb 06:45:08.349 # Server started, Redis version 2.8.4 [1709] 28 Feb 06:45:08.349 # 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. [1709] 28 Feb 06:45:08.349 * The server is now ready to accept connections on port 6379
啟動redis客戶端
redis-cli 127.0.0.1:6379>
如果是用apt-get或是yum install安裝的redis,可以直接透過下面的指令停止/啟動/重新啟動redis
/etc/init.d/redis-server stop /etc/init.d/redis-server start /etc/init.d/redis-server restart
注意:使用/etc/ init.d/redis-server start 方法啟動redis,那麼在那個目錄下啟動redis,那麼redis的備份檔就在那個目錄下。
如在/user/bin/redis/目錄下輸入指令/etc/init.d/redis-server start ,那麼redis備份檔就在/user/bin/redis/dump.rdb
如果是透過原始碼安裝的redis,則可以透過redis的客戶端程式redis-cli的shutdown指令來重啟redis
redis-cli -h 127.0.0.1 -p 6379 shutdown
如果上述方式都沒有成功停止redis,則可以使用終極武器kill -9
更多Redis相關知識,請造訪Redis使用教學欄位!
以上是redis如何重啟的詳細內容。更多資訊請關注PHP中文網其他相關文章!