標籤:tcp start 安裝 ant 配置 報錯 opp 更改 auth
? 安裝源碼包
[[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
70 bind 192.168.4.40 #修改ip
93 port 6040 #修改連接埠
[[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))
此時用指令碼關閉redis會報如下錯誤
[[email protected] ~]# redis_6379 -stop
Please use start, stop, restart or status as first argument
解決方案1:[[email protected] ~]# redis-cli -h 192.168.4.40 -p 6040 shutdown
解決方案2:需要變更指令碼檔案
[[email protected] ~]# vim /etc/init.d/redis_6379
8 REDISPORT="6040"
43 $CLIEXEC -h 192.168.4.40 -p $REDISPORT shutdown
設定完畢後就可以使用腳步關了
如:
[[email protected] ~]# ss -antulp | grep redis
tcp LISTEN 0 128 192.168.4.40:6040
: users:(("redis-server",pid=4846,fd=6))
關閉redis
[[email protected] ~]# redis_6379 stop
Stopping ...
Redis stopped
設定串連密碼
1.修改設定檔
[[email protected] ~]# vim /etc/redis/6379.conf
501 requirepass 123446(密碼)
設定秘密後我們用指令碼關閉檔案會出現如下報錯
[[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 ...
。。。。。。。。。。。
解決方案1:
[[email protected] ~]# redis-cli -h 192.168.4.40 -p 6040 -a 123446 shutdown
解決方案2:修改指令檔
43 $CLIEXEC -h 192.168.4.40 -p $REDISPORT -a 123446 shutdown
[[email protected] ~]# redis_6379 stop
Stopping ...
Waiting for Redis to shutdown ...
Redis stopped
redis資料庫的安裝及注意事項