最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Redis集群設(shè)置密碼訪問(wèn)的實(shí)現(xiàn)

 更新時(shí)間:2025年08月04日 11:53:24   作者:江畔獨(dú)步  
本文檔介紹了在Redis集群上配置和管理密碼,包括為每個(gè)節(jié)點(diǎn)添加requirepass配置以啟用密碼保護(hù),及通過(guò)redis-cli關(guān)閉集群時(shí)使用密碼,感興趣的可以了解一下

一、背景

1.1 主機(jī)位置

假定Redis集群服務(wù)部署在:111.111.111.111 主機(jī)上

1.2 偽分布式-配置文件位置

配置文件路徑:

[root@bigdata-test-db-0001 ~]# find / -name redis.conf
/data/redis_cluster/7001/redis.conf
/data/redis_cluster/7002/redis.conf
/data/redis_cluster/7003/redis.conf
/data/redis_cluster/7004/redis.conf
/data/redis_cluster/7005/redis.conf
/data/redis_cluster/7000/redis.conf

1.3 添加環(huán)境變量(略)

命令行工具路徑(已加入系統(tǒng)環(huán)境變量中):

redis-cli命令位置: /usr/local/bin/redis-cli

vim /etc/profile
export PATH=$PATH:/usr/local/bin

1.4 集群?jiǎn)⑼2僮?/h3>

啟動(dòng)集群:

cd /data/redis_cluster
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7000/redis.conf
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7001/redis.conf
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7002/redis.conf
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7003/redis.conf
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7004/redis.conf
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7005/redis.conf

關(guān)閉集群:

redis-cli -h 111.111.111.111 -p 7001  shutdown
redis-cli -h 111.111.111.111 -p 7000  shutdown
redis-cli -h 111.111.111.111 -p 7001  shutdown
redis-cli -h 111.111.111.111 -p 7002  shutdown
redis-cli -h 111.111.111.111 -p 7003  shutdown
redis-cli -h 111.111.111.111 -p 7004  shutdown
redis-cli -h 111.111.111.111 -p 7005  shutdown

1.5 操作無(wú)密碼的redis集群

無(wú)密碼命令行訪問(wèn):

[root@bigdata-test-db-0001 ~]# redis-cli -h 111.111.111.111 -p 7000
111.111.111.111:7000> keys *
1) "k3"
2) "k2"
111.111.111.111:7000> get k2
"v2"
111.111.111.111:7000> get k3
"v3"

二、為redis集群設(shè)置密碼

2.1 配置步驟

111.111.111.111:7000>
從7000到7005,依次按如下方式添加用于auth的password:

cd /data/redis_cluster
[root@bigdata-test-db-0001 redis_cluster]# vim 7000/redis.conf
 
添加如下語(yǔ)句:
requirepass ${YOUR_PASSWORD}
使用password方式連接redis集群:

如果去除集群訪問(wèn)密碼:
在700[0~5]中將配置文件中的 “requirepass ${YOUR_PASSWORD}” 注釋,重啟即可。

2.2 集群?jiǎn)⑼2僮?/h3>

啟動(dòng)集群:

cd /data/redis_cluster
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7000/redis.conf
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7001/redis.conf
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7002/redis.conf
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7003/redis.conf
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7004/redis.conf
[root@bigdata-test-db-0001 redis_cluster]# redis-server 7005/redis.conf

關(guān)閉集群:

redis-cli -h 111.111.111.111 -p 7001 -a ${YOUR_REDIS_PASSWORD} shutdown
redis-cli -h 111.111.111.111 -p 7000 -a ${YOUR_REDIS_PASSWORD} shutdown
redis-cli -h 111.111.111.111 -p 7001 -a ${YOUR_REDIS_PASSWORD} shutdown
redis-cli -h 111.111.111.111 -p 7002 -a ${YOUR_REDIS_PASSWORD} shutdown
redis-cli -h 111.111.111.111 -p 7003 -a ${YOUR_REDIS_PASSWORD} shutdown
redis-cli -h 111.111.111.111 -p 7004 -a ${YOUR_REDIS_PASSWORD} shutdown
redis-cli -h 111.111.111.111 -p 7005 -a ${YOUR_REDIS_PASSWORD} shutdown

2.3 操作有密碼的redis集群

通過(guò)密碼方式訪問(wèn)到redis集群:

redis-cli -h 111.111.111.111 -p 7000 -c -a ${YOUR_PASSWORD} --raw
 
111.111.111.111:7000> keys *
k3
k2
111.111.111.111:7000> get k3
-> Redirected to slot [4576] located at 111.111.111.111:7003
v3
111.111.111.111:7003> get v2
-> Redirected to slot [13550] located at 111.111.111.111:7002

到此這篇關(guān)于Redis集群設(shè)置密碼訪問(wèn)的文章就介紹到這了,更多相關(guān)Redis集群設(shè)置密碼訪問(wèn)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家! 

相關(guān)文章

  • 詳細(xì)分析Redis集群故障

    詳細(xì)分析Redis集群故障

    這篇文章主要介紹了詳細(xì)分析Redis集群故障的相關(guān)內(nèi)容,具有一定的參考價(jià)值,這里分享給大家,供需要的朋友參考。
    2017-10-10
  • 利用Redis進(jìn)行數(shù)據(jù)緩存的項(xiàng)目實(shí)踐

    利用Redis進(jìn)行數(shù)據(jù)緩存的項(xiàng)目實(shí)踐

    在實(shí)際的業(yè)務(wù)場(chǎng)景中,Redis 一般和其他數(shù)據(jù)庫(kù)搭配使用,用來(lái)減輕后端數(shù)據(jù)庫(kù)的壓力,本文就介紹了利用Redis進(jìn)行數(shù)據(jù)緩存的項(xiàng)目實(shí)踐,具有一定的參考價(jià)值,感興趣的可以了解一下
    2022-06-06
  • Redis分布式鎖的7種實(shí)現(xiàn)

    Redis分布式鎖的7種實(shí)現(xiàn)

    這篇文章主要介紹了Redis分布式鎖的實(shí)現(xiàn)
    2022-04-04
  • redis和rabbitmq實(shí)現(xiàn)延時(shí)隊(duì)列的示例代碼

    redis和rabbitmq實(shí)現(xiàn)延時(shí)隊(duì)列的示例代碼

    在高并發(fā)場(chǎng)景下,延遲隊(duì)列顯得尤為重要,本文主要介紹了兩種方式,redis和rabbitmq實(shí)現(xiàn)延時(shí)隊(duì)列,具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-03-03
  • Redis中緩存預(yù)熱與緩存穿透解決方案

    Redis中緩存預(yù)熱與緩存穿透解決方案

    Redis緩存預(yù)熱與緩存穿透是Redis緩存使用中的兩個(gè)重要概念,文章首先介紹了Redis緩存預(yù)熱和緩存穿透的基本概念,然后詳細(xì)闡述了它們的產(chǎn)生原因和解決方案,感興趣的可以了解一下
    2023-12-12
  • Redis基本數(shù)據(jù)類型示例詳解

    Redis基本數(shù)據(jù)類型示例詳解

    本文給大家介紹了Redis基本數(shù)據(jù)類型示例詳解,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧
    2025-09-09
  • 從MySQL到Redis的簡(jiǎn)單數(shù)據(jù)庫(kù)遷移方法

    從MySQL到Redis的簡(jiǎn)單數(shù)據(jù)庫(kù)遷移方法

    這篇文章主要介紹了從MySQL到Redis的簡(jiǎn)單數(shù)據(jù)庫(kù)遷移方法,注意Redis數(shù)據(jù)庫(kù)基于內(nèi)存,并不能代替?zhèn)鹘y(tǒng)數(shù)據(jù)庫(kù),需要的朋友可以參考下
    2015-06-06
  • Redis用GEO實(shí)現(xiàn)附近的人功能

    Redis用GEO實(shí)現(xiàn)附近的人功能

    GEO就是Geolocation的簡(jiǎn)寫形式,代表地理坐標(biāo),這篇文章主要介紹了Redis用GEO實(shí)現(xiàn)附近的人功能,需要的朋友可以參考下
    2024-08-08
  • Redis 配置文件重要屬性的具體使用

    Redis 配置文件重要屬性的具體使用

    Redis在IT公司中的使用率自不必說(shuō),今天我們就來(lái)介紹一下Redis 配置文件重要屬性的具體使用,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-05-05
  • 基于redis分布式鎖實(shí)現(xiàn)秒殺功能

    基于redis分布式鎖實(shí)現(xiàn)秒殺功能

    這篇文章主要為大家詳細(xì)介紹了基于redis分布式鎖實(shí)現(xiàn)秒殺功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-02-02

最新評(píng)論

灵山县| 枝江市| 民丰县| 万年县| 甘德县| 什邡市| 醴陵市| 通州区| 龙陵县| 揭东县| 耒阳市| 平塘县| 普陀区| 思南县| 高淳县| 汨罗市| 大洼县| 新蔡县| 泾川县| 昆明市| 蓬安县| 凤翔县| 皋兰县| 抚松县| 巴彦淖尔市| 凯里市| 年辖:市辖区| 营山县| 陈巴尔虎旗| 金阳县| 漳州市| 万载县| 晋州市| 炎陵县| 定日县| 赤峰市| 仙游县| 灵武市| 林甸县| 德庆县| 崇左市|