内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

Memcache高可用群集

云計(jì)算 Memcache高可用群集 實(shí)驗(yàn)環(huán)境: 主服務(wù)器 192.168.45.132 Telnet、libevent、memcached、keepalived、magent 從服務(wù)器 192.168.45.131 Telnet、libevent、memcached、keepalived 測(cè)試機(jī) 192.168.45.135 Telnet 實(shí)驗(yàn)?zāi)康模?p>實(shí)現(xiàn)存儲(chǔ)內(nèi)容的主從備份

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:空間域名、網(wǎng)站空間、營(yíng)銷(xiāo)軟件、網(wǎng)站建設(shè)、高縣網(wǎng)站維護(hù)、網(wǎng)站推廣。實(shí)驗(yàn)搭建: 一、主服務(wù)器: 1、掛載軟件包,
#掛載軟件包
mount.cifs //192.168.100.3/lzp /mnt

#創(chuàng)建目錄
mkdir /opt/magent       
#解壓必要安裝包
cd /mnt/mem
tar zxvf magent-0.5.tar.gz -C /opt/magent/
tar zxvf libevent-2.1.8-stable.tar.gz -C /opt
tar zxvf memcached-1.5.6.tar.gz -C /opt
#安裝必要組件
yum install gcc gcc-c++ make -y
2、對(duì)組件進(jìn)行編譯安裝
#編譯安裝libevent
cd /opt/libevent-2.1.8-stable/
./configure --prefix=/usr
make && make install

#編譯安裝memcached
cd /opt/memcached-1.5.6/
./configure --with-libevent=/usr
make && make install

#編譯安裝magent
cd /opt/magent/
#修改ketama.h文件
vim ketama.h
#ifndef SSIZE_MAX
#define SSIZE_MAX 32767
#將#endif移動(dòng)到第三行,刪除掉末尾的
#endif

vim Makefile
#第一行末尾添加-lm
LIBS = -levent-lm
#編譯
make

#編譯好的magent文件

3、將編譯好的magent文件復(fù)制到/usr/bin目錄下,并推送給從服務(wù)器
#安裝openssh推送軟件
yum install openssh-clients -y
#將編譯好的magent文件復(fù)制到/usr/bin目錄下
cp magent /usr/bin

#推送magent文件
scp magent root@192.168.45.131:/usr/bin
The authenticity of host \'192.168.45.131 (192.168.45.131)\' can\'t be established.
ECDSA key fingerprint is SHA256:bw2256OHr5apf7CliZv/fAOyVNVsMmRn+lZ5efeQgTg.
ECDSA key fingerprint is MD5:6f:f6:70:4f:46:64:ec:17:a7:ae:c0:15:1c:8b:55:1c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added \'192.168.45.131\' (ECDSA) to the list of known hosts.
root@192.168.45.131\'s password: 
magent                                     100%  112KB   5.8MB/s   00:00  
4、關(guān)閉防火墻和安全功能
systemctl stop firewalld.service 
setenforce 0
5、安裝keepalived,并進(jìn)行修改
#安裝keepalived
yum install keepalived -y

#修改配置文件
vim /etc/keepalived/keepalived.conf 

! Configuration File for keepalived
#寫(xiě)入下列內(nèi)容
vrrp_script magent {
        script /opt/shell/magent.sh
        interval 2
}

global_defs {
   notification_email {
     acassen@firewall.loc
     failover@firewall.loc
     sysadmin@firewall.loc
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   #修改route-id
   router_id MAGENT_HA
}

vrrp_instance VI_1 {
    state MASTER
    #修改網(wǎng)卡端口
    interface ens33
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    #修改,調(diào)用上邊函數(shù)
    track_script {
        magent
   }
    virtual_ipaddress {
    #設(shè)置虛擬指向地址
        192.168.45.188
    }
}
6、創(chuàng)建magent腳本
mkdir /opt/shell
cd /opt/shell/
vim magent.sh

#!/bin/bash
K=`ps -ef | grep keepalived | grep -v grep | wc -l`
if [ $K -gt 0 ];then
        magent -u root -n 51200 -l 192.168.45.188 -p 12000 -s 192.168.45.132:
11211 -b 192.168.45.131:11211
else
pkill -9 magent
fi

#給于運(yùn)行權(quán)限
chmod +x magent.sh
7、啟動(dòng)服務(wù),并查看
#啟動(dòng)keepalived
systemctl start keepalived.service

#查看遷移地址
ip addr

#啟動(dòng)memcached 
memcached -m 512k -u root -d -l 192.168.45.132 -p 11211

安裝telent進(jìn)行測(cè)試
yum install telnet -y

二、從服務(wù)器 1、掛載軟件包,并關(guān)閉防火墻和安全功能
mount.cifs //192.168.100.3/lzp /mnt
#關(guān)閉防火墻和安全功能
systemctl stop firewalld.service 
setenforce 0
2、解壓安裝包,并進(jìn)行編譯
#解壓安裝包
cd /mnt/mem
tar zxvf libevent-2.1.8-stable.tar.gz -C /opt
tar zxvf memcached-1.5.6.tar.gz -C /opt
#安裝必要組件包
yum install gcc gcc-c++ make -y
#編譯安裝libevent
cd /opt/libevent-2.1.8-stable/
./configure --prefix=/usr
make && make install
#編譯安裝memcached
cd /opt/memcached-1.5.6/
./configure --with-libevent=/usr
make && make install
3、安裝keepalived
#安裝keepalived
yum install keepalived -y
#修改keepalived文件
cd /etc/keepalived/
mv keepalived.conf keepalived.conf.bk

vim keepalived.conf

! Configuration File for keepalived

vrrp_script magent {
        script /opt/shell/magent.sh
        interval 2
}

global_defs {
   notification_email {
     acassen@firewall.loc
     failover@firewall.loc
     sysadmin@firewall.loc
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   #修改router_id
   router_id MAGENT_HB
}

vrrp_instance VI_1 {
    state BACKUP
    #修改網(wǎng)絡(luò)接口
    interface ens33
    #修改virtual_router_id
    virtual_router_id 52
    #修改優(yōu)先級(jí)
    priority 90
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    track_script {
        magent
   }
    virtual_ipaddress {
        #修改地址
        192.168.45.188
    }
}
4、創(chuàng)建magent腳本
mkdir /opt/shell
cd /opt/shell/
vim magent.sh
#!/bin/bash
K=`ip addr | grep 192.168.45.188 | grep -v grep | wc -l`
if [ $K -gt 0 ];then
        magent -u root -n 51200 -l 192.168.45.188 -p 12000 -s 192.168.45.132:
11211 -b 192.168.45.131:11211
else
pkill -9 magent
fi
chmod +x magent.sh
4、啟動(dòng)服務(wù)
#啟動(dòng)keepalived
systemctl start keepalived.service
 #啟動(dòng)memcached
memcached -m 512k -u root -d -l 192.168.45.131 -p 11211
安裝telent進(jìn)行測(cè)試
yum install telnet -y

三、客戶機(jī)
#關(guān)閉防火墻和安全功能
systemctl stop firewalld.service 
setenforce 0
#安裝telnet 
yum install telnet -y
#在telnet中寫(xiě)入文件
[root@manager ~]# telnet 192.168.45.188 12000
Trying 192.168.45.188...
Connected to 192.168.45.188.
Escape character is \'^]\'.
add username 0 0 7
1234567
STORED

在從服務(wù)器上查看

在主服務(wù)器上查看

上邊我們實(shí)驗(yàn)就做好了

當(dāng)前標(biāo)題:Memcache高可用群集
文章地址:http://www.rwnh.cn/article36/cgcpsg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、標(biāo)簽優(yōu)化外貿(mào)網(wǎng)站建設(shè)、微信小程序網(wǎng)站營(yíng)銷(xiāo)、網(wǎng)站設(shè)計(jì)公司

廣告

聲明:本網(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)頁(yè)設(shè)計(jì)公司
隆安县| 阿图什市| 门源| 江西省| 保康县| 原平市| 禹州市| 锦州市| 赞皇县| 安泽县| 遂溪县| 长武县| 泰州市| 砀山县| 溆浦县| 绥德县| 黄石市| 桃江县| 宝应县| 贵溪市| 依安县| 峨山| 珠海市| 石门县| 白银市| 韶关市| 万山特区| 象山县| 阳山县| 淮安市| 哈尔滨市| 枝江市| 延寿县| 建昌县| 从化市| 来凤县| 长春市| 华坪县| 新沂市| 广南县| 额敏县|