欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

緩存數(shù)據(jù)庫Redis——Redis群集部署-創(chuàng)新互聯(lián)

實(shí)驗(yàn)環(huán)境

用兩臺(tái)服務(wù)器模擬6臺(tái)服務(wù)器(添加網(wǎng)卡)

主服務(wù)器Redis1:
     ens33: 192.168.52.150
     ens36: 192.168.52.153
     ens37: 192.168.52.154
從服務(wù)器Redis2:
    ens33: 192.168.52.148
    ens36: 192.168.52.155
    ens37: 192.168.52.156

1、在兩臺(tái)服務(wù)器上都安裝Redis(操作相同,只演示一臺(tái))

[root@localhost ~]# yum install gcc gcc-c++ make -y  ##安裝環(huán)境組件
[root@localhost ~]# mkdir /mnt/tools
[root@localhost ~]# mount.cifs //192.168.100.100/tools /mnt/tools/  ##掛載
Password for root@//192.168.100.100/tools:  
[root@localhost ~]# cd /mnt/tools/redis/
[root@localhost redis]# ls
redis-5.0.7.tar.gz
[root@localhost redis]# tar xf redis-5.0.7.tar.gz -C /opt/  ##解壓
[root@localhost redis]# cd /opt/
[root@localhost opt]# ls
redis-5.0.7  rh
[root@localhost opt]# cd redis-5.0.7/
[root@localhost redis-5.0.7]# make  ##編譯
[root@localhost redis-5.0.7]# make PREFIX=/usr/local/redis/ install  ##安裝
[root@localhost redis-5.0.7]# cd utils/
[root@localhost utils]# ./install_server.sh    ##執(zhí)行腳本進(jìn)行配置
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379]   ##默認(rèn)端口
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]   ##配置文件
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]   ##日志文件
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]   ##數(shù)據(jù)文件
Selected default - /var/lib/redis/6379
Please select the redis executable path [] /usr/local/redis/bin/redis-server
##可執(zhí)行文件路徑
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /var/log/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable    : /usr/local/redis/bin/redis-server
Cli Executable : /usr/local/redis/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
[root@localhost utils]# ln -s /usr/local/redis/bin/* /usr/local/bin/   ##便于系統(tǒng)識(shí)別
[root@localhost utils]# netstat -ntap | grep 6379
tcp    0    0 127.0.0.1:6379      0.0.0.0:*      LISTEN   44510/redis-server

2、在兩臺(tái)服務(wù)器上修改配置文件(操作相同,只演示一臺(tái))

[root@localhost utils]# vim /etc/redis/6379.conf 
#bind 127.0.0.1          ##注釋第70行的監(jiān)聽127地址,已監(jiān)聽所有地址
protected-mode no     ##去掉第89行注釋關(guān)閉安全保護(hù)
port 6379                   ##去掉第93行注釋,開啟端口6379
daemonize yes          ##去掉第137行注釋,以獨(dú)立進(jìn)程啟動(dòng)
cluster-enabled yes   ##去掉第833行注釋,開啟群集功能
cluster-config-file nodes-6379.conf  ##去掉第841行注釋,群集名稱文件設(shè)置
cluster-node-timeout 15000             ##去掉第847行注釋,群集超時(shí)時(shí)間設(shè)置
appendonly yes                                ##去掉第700行注釋,開啟aof持久化
[root@localhost utils]# /etc/init.d/redis_6379 restart   ##重啟服務(wù)
Stopping ...
Redis stopped
Starting Redis server...
[root@localhost utils]# cd /var/lib/redis/6379/
[root@localhost 6379]# ls
appendonly.aof  dump.rdb  nodes-6379.conf   ##生成aof,rdb和節(jié)點(diǎn)文件

3、在主服務(wù)器上安裝rvm,Ruby控制群集軟件(只在主服務(wù)器)

[root@localhost utils]# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
##導(dǎo)入key文件
gpg: 已創(chuàng)建目錄‘/root/.gnupg’
gpg: 新的配置文件‘/root/.gnupg/gpg.conf’已建立
gpg: 警告:在‘/root/.gnupg/gpg.conf’里的選項(xiàng)于此次運(yùn)行期間未被使用
gpg: 鑰匙環(huán)‘/root/.gnupg/secring.gpg’已建立
gpg: 鑰匙環(huán)‘/root/.gnupg/pubring.gpg’已建立
gpg: 下載密鑰‘D39DC0E3’,從 hkp 服務(wù)器 keys.gnupg.net
gpg: /root/.gnupg/trustdb.gpg:建立了信任度數(shù)據(jù)庫
gpg: 密鑰 D39DC0E3:公鑰“Michal Papis (RVM signing) <mpapis@gmail.com>”已導(dǎo)入
gpg: 沒有找到任何絕對(duì)信任的密鑰
gpg: 合計(jì)被處理的數(shù)量:1
gpg:           已導(dǎo)入:1  (RSA: 1)
[root@localhost utils]# curl -sSL https://get.rvm.io | bash -s stable ##安裝rvm
........................//省略過程
[root@localhost utils]# source /etc/profile.d/rvm.sh  ##執(zhí)行環(huán)境變量
[root@localhost utils]# rvm list known   ##列出ruby可以安裝的版本
[root@localhost utils]# rvm install 2.4.1  ##安裝2.4.1 版本
[root@localhost utils]# rvm use 2.4.1  ##使用rubyruby2.4.1 版本
Using /usr/local/rvm/gems/ruby-2.4.1
[root@localhost utils]# ruby -v   ##查看當(dāng)前ruby2.4.1 版本
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
[root@localhost utils]# gem install redis  #再次安裝Redis
Fetching redis-4.1.3.gem
Successfully installed redis-4.1.3
Parsing documentation for redis-4.1.3
Installing ri documentation for redis-4.1.3
Done installing documentation for redis after 1 seconds
1 gem installed
[root@localhost utils]#

4、在主服務(wù)器上添加兩塊網(wǎng)卡

緩存數(shù)據(jù)庫Redis——Redis群集部署

創(chuàng)新互聯(lián)是專業(yè)的平魯網(wǎng)站建設(shè)公司,平魯接單;提供做網(wǎng)站、成都做網(wǎng)站,網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行平魯網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
[root@localhost utils]#  service network restart   ##重啟網(wǎng)卡
[root@localhost utils]#  systemctl stop firewalld.service   ##關(guān)閉防火墻
[root@localhost utils]#  setenforce 0
[root@localhost utils]# ifconfig 
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.52.150  netmask 255.255.255.0  broadcast 192.168.52.255
        inet6 fe80::5134:22f5:842b:5201  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:0d:f1:75  txqueuelen 1000  (Ethernet)
        RX packets 91575  bytes 119014065 (113.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 28442  bytes 2443621 (2.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.52.153  netmask 255.255.255.0  broadcast 192.168.52.255
        inet6 fe80::84f1:53d8:a97a:d450  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:0d:f1:89  txqueuelen 1000  (Ethernet)
        RX packets 128  bytes 18873 (18.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 42  bytes 6253 (6.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens37: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.52.154  netmask 255.255.255.0  broadcast 192.168.52.255
        inet6 fe80::74f5:2344:c59b:4fdb  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:0d:f1:7f  txqueuelen 1000  (Ethernet)
        RX packets 107  bytes 16849 (16.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 29  bytes 4601 (4.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

5、在從服務(wù)器上也添加兩塊網(wǎng)卡

緩存數(shù)據(jù)庫Redis——Redis群集部署

[root@slave utils]# service network restart   ##重啟網(wǎng)卡
[root@slave utils]# systemctl stop firewalld.service   ##關(guān)閉防火墻
[root@slave utils]# setenforce 0
[root@localhost utils]# ifconfig 
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.52.148  netmask 255.255.255.0  broadcast 192.168.52.255
        inet6 fe80::c776:9d00:618:88f2  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:37:e9:25  txqueuelen 1000  (Ethernet)
        RX packets 65481  bytes 86357533 (82.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 21069  bytes 1892475 (1.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.52.155  netmask 255.255.255.0  broadcast 192.168.52.255
        inet6 fe80::d3e5:cd6b:26f8:fd1f  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:37:e9:39  txqueuelen 1000  (Ethernet)
        RX packets 143  bytes 17342 (16.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 38  bytes 5940 (5.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens37: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.52.156  netmask 255.255.255.0  broadcast 192.168.52.255
        inet6 fe80::222b:77ad:8da2:4ea6  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:37:e9:2f  txqueuelen 1000  (Ethernet)
        RX packets 114  bytes 14481 (14.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 30  bytes 4661 (4.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

6、在master服務(wù)器上創(chuàng)建集群

##6個(gè)實(shí)例分為三組,每組一主一從
[root@localhost utils]# redis-cli --cluster create 192.168.52.150:6379 192.168.52.153:6379 192.168.52.154:6379 192.168.52.148:6379 192.168.52.155:6379 192.168.52.156:6379 --cluster-replicas 1
##創(chuàng)建群集,每組一主一從
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 192.168.52.155:6379 to 192.168.52.150:6379
Adding replica 192.168.52.156:6379 to 192.168.52.153:6379
Adding replica 192.168.52.148:6379 to 192.168.52.154:6379
M: b9dfae79d92141a7bad172a344e0696f356a875f 192.168.52.150:6379
   slots:[0-16383] (5461 slots) master    ##128,129,135為主
M: b9dfae79d92141a7bad172a344e0696f356a875f 192.168.52.153:6379
   slots:[0-16383] (5462 slots) master
M: b9dfae79d92141a7bad172a344e0696f356a875f 192.168.52.154:6379
   slots:[0-16383] (5461 slots) master
S: ebc69ee01cf293b3af9930cac2dba03b4475336b 192.168.52.148:6379
   replicates b9dfae79d92141a7bad172a344e0696f356a875f  ##136,137,138為副本
S: ebc69ee01cf293b3af9930cac2dba03b4475336b 192.168.52.155:6379
   replicates b9dfae79d92141a7bad172a344e0696f356a875f
S: ebc69ee01cf293b3af9930cac2dba03b4475336b 192.168.52.156:6379
   replicates b9dfae79d92141a7bad172a344e0696f356a875f
...
Can I set the above configuration? (type 'yes' to accept): yes  ##選擇yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join

>>> Performing Cluster Check (using node 192.168.52.150:6379)
M: b9dfae79d92141a7bad172a344e0696f356a875f 192.168.52.150:6379
   slots:[0-16383] (16384 slots) master
   1 additional replica(s)
S: ebc69ee01cf293b3af9930cac2dba03b4475336b 192.168.52.155:6379
   slots: (0 slots) slave
   replicates b9dfae79d92141a7bad172a344e0696f356a875f
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
[root@localhost utils]#

7、驗(yàn)證群集讀寫原理

[root@localhost utils]# redis-cli -h 192.168.52.150 -p 6379   ##主服務(wù)器
192.168.52.150:6379> set name zhangsan   ##創(chuàng)建鍵值對(duì)
OK 
192.168.52.150:6379> keys *
1) "name"
192.168.52.150:6379> get name
"zhangsan"
192.168.52.150:6379> exit
[root@localhost utils]# redis-cli -h 192.168.52.148 -p 6379   ##從服務(wù)器
192.168.52.148:6379> keys *    ##查看從上也有
1) "name"
192.168.52.148:6379> get name
"zhangsan"
192.168.52.148:6379> exit
[root@localhost utils]#

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

分享題目:緩存數(shù)據(jù)庫Redis——Redis群集部署-創(chuàng)新互聯(lián)
網(wǎng)頁URL:http://aaarwkj.com/article24/ccoece.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、網(wǎng)站營銷網(wǎng)站導(dǎo)航、小程序開發(fā)、App設(shè)計(jì)、ChatGPT

廣告

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

營銷型網(wǎng)站建設(shè)
99热这里只有精品免费播放| 日韩中文字幕视频久久| 高清av在线国产成人精品自拍| 精品人妻一区二区三区mp4| 深夜视频在线观看成人| 亚洲成人福利免费网站| 欧美aⅴ一区二区三区| 日本精品视频一区二区三区| 日本色网一区二区三区四区| 91福利社区欧美大片| 国产精品视频在线播放| 国产成人午夜视频免费一区| 亚洲高清有码在线观看| 成人黄色小视频下载| 欧美日韩国产另类在线视频| 亚洲av成人三区国产精品| av真人青青小草一区二区欧美 | 久久成人影院免费观看| 久久热这里只有精品网站| 中文字幕在线视频黄字幕| 亚洲av永久国产剧情| 亚洲国产日本一区自拍| 亚洲成人免费电影观看| 色在色在线播放亚洲中文| 国产熟女真实乱精品视频| 日韩在线国产亚洲精品| 亚洲成人日韩欧美在线| 日韩美女后入式在线视频| 亚洲黄色录像特级生活片| 日本大片在线一区二区三区| 久久久亚洲成人国产av| 亚洲ve中文字幕久久一区二区| 午夜福利在线视频观看| 国产原创av剧情愿望成真| 日韩精品一区二区三区av在线| 国产一级黄色片免费看| 午夜高清影院免费观看| 日日添夜夜躁欧美一区二区| 日韩一区二区中文字幕| 中文字幕国产精品综合| 日本少妇熟女一区二区|