redis資料庫的安裝及注意事項

來源:互聯網
上載者:User

標籤: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資料庫的安裝及注意事項

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.