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

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

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

一、背景

1.1 主機位置

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

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 集群啟停操作

啟動集群:

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 操作無密碼的redis集群

無密碼命令行訪問:

[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
 
添加如下語句:
requirepass ${YOUR_PASSWORD}
使用password方式連接redis集群:

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

2.2 集群啟停操作

啟動集群:

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集群

通過密碼方式訪問到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è)置密碼訪問的文章就介紹到這了,更多相關(guān)Redis集群設(shè)置密碼訪問內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家! 

相關(guān)文章

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

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

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

    利用Redis進行數(shù)據(jù)緩存的項目實踐

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

最新評論

河曲县| 海淀区| 绥棱县| 教育| 龙岩市| 南京市| 江城| 公安县| 个旧市| 海兴县| 无极县| 天气| 肃南| 吐鲁番市| 历史| 涿鹿县| 隆尧县| 交城县| 隆德县| 莎车县| 海盐县| 承德县| 万全县| 岗巴县| 隆回县| 张家川| 万载县| 昌吉市| 大埔县| 乌什县| 缙云县| 台中市| 涿州市| 鄂伦春自治旗| 永胜县| 宽甸| 瓮安县| 甘谷县| 平利县| 阿合奇县| 综艺|