? Install the source package
[Email protected] ~]# tar-xf redis/redis-4.0.8.tar.gz-c.
[Email protected] ~]# CD redis-4.0.8/
[Email protected] redis-4.0.8]# yum-y install gcc gcc-c++
[[email protected] redis-4.0.8]# make && make install
[Email protected] redis-4.0.8]#./utils/install_server.sh
[Email protected] redis-4.0.8]# vim/etc/redis/6379.conf
Bind 192.168.4.40 #修改ip
6040 Port #修改端口
[Email protected] redis-4.0.8]# ln-s/etc/init.d/redis_6379/sbin/
[[email protected] redis-4.0.8]# redis_6379 stop
[[email protected] redis-4.0.8]# redis_6379 start
[Email protected] ~]# Ss-antulp | grep Redis
TCP LISTEN 0 128 192.168.4.40:6040
:Users: (("Redis-server", pid=4846,fd=6))
The following error is reported when you close redis with a script
[Email protected] ~]# Redis_6379-stop
Please use start, stop, restart or status as first argument
Workaround 1:[[email Protected] ~]# redis-cli-h 192.168.4.40-p 6040 shutdown
Workaround 2: You need to change the script file
[Email protected] ~]# vim/etc/init.d/redis_6379
8 redisport= "6040"
$CLIEXEC-H 192.168.4.40-p $REDISPORT shutdown
Once you've set it up, you can turn it off.
Such as:
[Email protected] ~]# Ss-antulp | grep Redis
TCP LISTEN 0 128 192.168.4.40:6040
:Users: (("Redis-server", pid=4846,fd=6))
Turn off Redis
[[email protected] ~]# redis_6379 stop
Stopping ...
Redis stopped
Setting the connection password
1. Modify the configuration file
[Email protected] ~]# vim/etc/redis/6379.conf
501 Requirepass 123446 (password)
After we set the secret, we use the script to close the file with the following error
[[email protected] ~]# redis_6379 stop
Stopping ...
(Error) Noauth Authentication required.
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
。。。。。。。。。。。
Workaround 1:
[Email protected] ~]# redis-cli-h 192.168.4.40-p 6040-a 123446 shutdown
Solution 2: Modify the script file
$CLIEXEC-H 192.168.4.40-p $REDISPORT-a 123446 shutdown
[[email protected] ~]# redis_6379 stop
Stopping ...
Waiting for Redis to shutdown ...
Redis stopped
Installation and considerations for Redis database