免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

CentOS7.4如何安裝redis4.0-創(chuàng)新互聯(lián)

這篇文章主要為大家展示了“CentOS 7.4如何安裝redis 4.0”,內(nèi)容簡(jiǎn)而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“CentOS 7.4如何安裝redis 4.0”這篇文章吧。

成都網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁(yè)設(shè)計(jì)、重慶網(wǎng)站建設(shè)、微信開(kāi)發(fā)、小程序開(kāi)發(fā)、集團(tuán)成都企業(yè)網(wǎng)站定制等服務(wù)項(xiàng)目。核心團(tuán)隊(duì)均擁有互聯(lián)網(wǎng)行業(yè)多年經(jīng)驗(yàn),服務(wù)眾多知名企業(yè)客戶;涵蓋的客戶類型包括:花箱等眾多領(lǐng)域,積累了大量豐富的經(jīng)驗(yàn),同時(shí)也獲得了客戶的一致贊美!

一、redis單實(shí)例安裝


1、安裝依賴包

[root@VM_2_13_centos redis]# yum install gcc*

2、獲取安裝文件

[root@VM_2_13_centos redis]# wget http://download.redis.io/releases/redis-4.0.9.tar.gz

3、解壓文件

[root@VM_2_13_centos redis]# tar zxvf redis-4.0.9.tar.gz

[root@VM_2_13_centos redis]# ll

total 1708

drwxrwxr-x 6 root root    4096 Mar 27 00:04 redis-4.0.9

-rw-r--r-- 1 root root 1737022 Mar 27 00:04 redis-4.0.9.tar.gz

4、編譯安裝

[root@VM_2_13_centos redis-4.0.9]# make

[root@VM_2_13_centos redis-4.0.9]# make PREFIX=/usr/local/redis install

cd src && make install

make[1]: Entering directory `/usr/local/redis/redis-4.0.9/src'

    CC Makefile.dep

make[1]: Leaving directory `/usr/local/redis/redis-4.0.9/src'

make[1]: Entering directory `/usr/local/redis/redis-4.0.9/src'

Hint: It's a good idea to run 'make test' ;)

    INSTALL install

    INSTALL install

    INSTALL install

    INSTALL install

    INSTALL install

5、查看redis的版本

[root@VM_2_13_centos ~]# redis-server --version

Redis server v=4.0.9 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=c97ec2b5e9b86914

6、啟動(dòng)redis

[root@VM_2_13_centos redis]# /usr/local/redis/bin/redis-server /etc/redis/redis.conf

[root@VM_2_13_centos redis]# netstat -tuplan | grep 6379

tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      5305/redis-server 1

[root@VM_2_13_centos redis]# ps -ef | grep redis

root      5305     1  0 21:38 ?        00:00:00 /usr/local/redis/bin/redis-server 127.0.0.1:6379

root      5356 30807  0 21:39 pts/1    00:00:00 grep --color=auto redis

7、通過(guò)客戶端登錄

[root@VM_2_13_centos ~]# redis-cli

127.0.0.1:6379>

備注:如果要卸載redis,把/usr/local/redis/bin/目錄下的redis刪除即可。為了卸載干凈,你還可以把解壓和編譯的redis包及配置的redis.conf也刪除。

二、安全配置

1、設(shè)置密碼

redis的默認(rèn)安裝是不設(shè)置密碼的,可以在redis.conf中進(jìn)行配置

[root@VM_2_13_centos ~]# vim /etc/redis/redis.conf

requirepass qcloud@2018

或者通過(guò)命令配置

127.0.0.1:6379>CONFIG set requirepass qcloud@2018

由于Redis的性能極高,并且輸入錯(cuò)誤密碼后Redis并不會(huì)進(jìn)行主動(dòng)延遲(考慮到Redis的單線程模型),所以攻擊者可以通過(guò)窮舉法破解Redis的密碼(1秒內(nèi)能夠嘗試十幾萬(wàn)個(gè)密碼),因此在設(shè)置時(shí)一定要選擇復(fù)雜的密碼,可以用隨機(jī)密碼生成器生成。

注意:配置Redis復(fù)制的時(shí)候如果主數(shù)據(jù)庫(kù)設(shè)置了密碼,需要在從數(shù)據(jù)庫(kù)的配置文件中通過(guò)masterauth參數(shù)設(shè)置主數(shù)據(jù)庫(kù)的密碼,以使從數(shù)據(jù)庫(kù)連接主數(shù)據(jù)庫(kù)時(shí)自動(dòng)使用AUTH命令認(rèn)證。

驗(yàn)證密碼是否有效,是否需要認(rèn)證

[root@VM_2_13_centos ~]# redis-cli

127.0.0.1:6379>

127.0.0.1:6379> keys *

(error) NOAUTH Authentication required.

127.0.0.1:6379>

127.0.0.1:6379> auth qcloud@2018

OK

127.0.0.1:6379>

127.0.0.1:6379> keys *

(empty list or set)

2、禁用高危命令

目前該命令可以正常使用

127.0.0.1:6379> flushall

OK

關(guān)閉redis,但是由于上面設(shè)置了密碼,必須要認(rèn)證成功后才能關(guān)閉

[root@VM_2_13_centos ~]# redis-cli shutdown

(error) NOAUTH Authentication required.

[root@VM_2_13_centos ~]# redis-cli -a qcloud@2018 shutdown

[root@VM_2_13_centos ~]#

[root@VM_2_13_centos ~]# ps -ef | grep redis

root      6144  5406  0 21:54 pts/0    00:00:00 grep --color=auto redis

修改配置文件redis.conf,增加如下行:

[root@VM_2_13_centos ~]# vim /etc/redis/redis.conf

rename-command FLUSHALL ""

rename-command CONFIG   ""

rename-command EVAL     ""

重新啟動(dòng)redis

[root@VM_2_13_centos ~]# redis-server /etc/redis/redis.conf

[root@VM_2_13_centos ~]#

[root@VM_2_13_centos ~]# redis-cli

127.0.0.1:6379>

127.0.0.1:6379> keys *

(error) NOAUTH Authentication required.

127.0.0.1:6379>

127.0.0.1:6379> auth qcloud@2018

OK

127.0.0.1:6379>

127.0.0.1:6379> flushall

(error) ERR unknown command 'flushall'

127.0.0.1:6379>

127.0.0.1:6379> config

(error) ERR unknown command 'config'

127.0.0.1:6379>

127.0.0.1:6379> eval

(error) ERR unknown command 'eval'

通過(guò)上面的報(bào)錯(cuò)可以發(fā)現(xiàn),在配置文件禁用的三個(gè)命令無(wú)法使用

3、綁定只能本機(jī)訪問(wèn)

[root@VM_2_13_centos ~]# vim /etc/redis/redis.conf

bind 127.0.0.1

4、設(shè)置redis開(kāi)啟自啟動(dòng)

[root@VM_2_13_centos ~]# vim /etc/rc.d/rc.local

/usr/local/redis/bin/redis-server /etc/redis/redis.conf &

以上是“CentOS 7.4如何安裝redis 4.0”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道!

新聞名稱:CentOS7.4如何安裝redis4.0-創(chuàng)新互聯(lián)
當(dāng)前地址:http://newbst.com/article28/dgggjp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供自適應(yīng)網(wǎng)站、定制網(wǎng)站、全網(wǎng)營(yíng)銷推廣網(wǎng)站排名關(guān)鍵詞優(yōu)化微信公眾號(hào)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司