浙江11选5今天开奖号码是多少钱:Linux基礎教程之lvs實戰講解

浙江11选5任3遗漏 www.ehxis.com lvs實踐(lvs+nginx+mariadb+php—fpm+nfs搭建wordpress)

 

lvs實踐(lvs+nginx+mariadb+php—fpm+nfs搭建wordpress)

1
lvs_dr模型
1
nginx
1
mariadb
1
php-fpm
1
wordpress

 

 

實驗拓撲

lvs項目.jpg-155.4kB

要求說明:
????1、lvs——director調度兩臺nginx+php-fpm?real?server?采用dr模型?算法為rr
????2、mriadb為real?server提供數據庫?nfs掛載至2臺real-server提供文件服務
????3、為了方便起見各節點iptables和selinux均已關閉。
????4、windows本地提供host文件做解析z.com至

step1:網絡配置

按照拓撲圖要求配置網絡環境。

step2:各節點軟件安裝

lvs——director:

?#yum?-y?install?ipvsadm

兩臺real server:

#?yum?-y?install?nginx?nfs-utils?rpcbind
#?yum?-y?install?php-fpm?php-mysql?php-gd?php-mbstring?php-mcrypt

nfs-server:

#?yum?-y?install?nfs-utils?rpcbind

Mariadb-server

#yum?-y?install?mariadb*

step3:服務配置

nfs_server配置

#groupadd?www?-g?501
#useradd?www?-u?501?-g?www?-M?-r??
#mkdir?/usr/share/nginx/html/
#chown?-R?www:www?/usr/share/nginx/html/
#?echo?'/usr/share???192.168.3.0/24(rw,sync,all_squash,anongid=501,anonuid=501)'?>?/etc/exports
#exportfs?-rv
#systemctl?start?rpcbind.service?
#systemctl?start?nfs.service?
#cd?/usr/share/nginx/html/
#準備好wordpress
#wget?https://cn.wordpress.org/wordpress-4.5.2-zh_CN.tar.gz
#?tar?zxvf?wordpress-4.5.2-zh_CN.tar.gz
#?cp?-R?wordpress/*?./
#?cp?wp-config-sample.php?wp-config-sample.php.bak
#?mv?wp-config-sample.php?wp-config.php
#修改如下?部分略
#<?php
/**
?*?WordPress基礎配置文件。
?*
?*?這個文件被安裝程序用于自動生成wp-config.php配置文件,
?*?您可以不使用網站,您需要手動復制這個文件,
?*?并重命名為“wp-config.php”,然后填入相關信息。
?*
?*?本文件包含以下配置選項:
?*
?*?*?MySQL設置
?*?*?密鑰
?*?*?數據庫表名前綴
?*?*?ABSPATH
?*
?*[email protected]?https://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php
?*
?*[email protected]?WordPress
?*/

//?**?MySQL?設置?-?具體信息來自您正在使用的主機?**?//
/**?WordPress數據庫的名稱?*/
define('DB_NAME',?'wordpress');

/**?MySQL數據庫用戶名?*/
define('DB_USER',?'wordpress');

/**?MySQL數據庫密碼?*/
define('DB_PASSWORD',?'123456');

/**?MySQL主機?*/
define('DB_HOST',?'192.168.3.8');

lvs—director

#ifconfig?eno16777736:0?192.168.2.11/32?broadcast?192.168.2.11?up
#route?add?-host?192.168.2.11?dev?eno16777736:0

兩臺real—server

#echo?1?>?/proc/sys/net/ipv4/conf/all/arp_ignore
#echo?2?>?/proc/sys/net/ipv4/conf/all/arp_announce
#echo?1?>?/proc/sys/net/ipv4/conf/eno16777736/arp_ignore
#?echo?2?>?/proc/sys/net/ipv4/conf/eno16777736/arp_announce
#ifconfig?lo:0?192.168.2.11/32?broadcast?192.168.2.11?up
#route?add?-host?192.168.2.11?dev?lo:0
#systemctl?start?rpcbind.service
#mount?-t?nfs?192.168.3.9:/usr/share/?/usr/share/nginx
#?df?-h

文件系統??????????????????????容量??已用??可用?已用%?掛載點
/dev/mapper/centos-root????????18G??1.4G???17G????8%?/
devtmpfs??????????????????????105M?????0??105M????0%?/dev
tmpfs?????????????????????????115M?????0??115M????0%?/dev/shm
tmpfs?????????????????????????115M??8.6M??107M????8%?/run
tmpfs?????????????????????????115M?????0??115M????0%?/sys/fs/cgroup
/dev/sda1?????????????????????497M??124M??373M???25%?/boot
tmpfs??????????????????????????23M?????0???23M????0%?/run/user/0
192.168.3.9:/usr/share/nginx???18G??1.1G???17G????7%?/usr/share/nginx
#?vim?/etc/nginx/conf.d/z.com.conf

server?{
????listen??????????80;
????server_name?????z.com;
????root????????????/htdocs/z_com;
????index???????????index.php;
????add_header?X-via?$server_addr;

????location?/?{
????????????root????/htdocs/z_com;
????????????index???index.php?index.html?index.html;
????}

????location?~*?\.(jpg|jpeg|png|gif|js|css)$?{
????????????root????/htdocs/z_com;
????}

????location?~?\.php$?{
????????????root????????????/htdocs/z_com;
????????????fastcgi_pass????127.0.0.1:9000;
????????????fastcgi_index???index.php;
????????????fastcgi_param???SCRIPT_FILENAME?/htdocs/z_com$fastcgi_script_name;
????????????include?????????fastcgi_params;
????}
}
#systemctl?start?nginx.service

Mariadb數據庫配置

#systemctl?start?mariadb.service
#mysql
MariaDB?[(none)]>?create?database?wordpress;
grant?all?on?wordpress.*?to?'wordpress'@'%'?identified?by?'123456';

step4:lvsdirector集群配置

#ipvsadm?-A?-t?192.168.2.11:80?-s?rr
#ipvsadm?-a?-t?192.168.2.11:80?-r?192.168.2.117?-g
#ipvsadm?-a?-t?192.168.2.11:80?-r?192.168.2.135?-g
#?ipvsadm?-Ln
IP?Virtual?Server?version?1.2.1?(size=4096)
Prot?LocalAddress:Port?Scheduler?Flags
??->?RemoteAddress:Port???????????Forward?Weight?ActiveConn?InActConn
TCP??192.168.2.11:80?rr
??->?192.168.2.117:80?????????????Route???1??????0??????????0?????????
??->?192.168.2.135:80?????????????Route???1??????0??????????0

最后效果如下
QQ圖片20161214002614.png-80.1kB
QQ圖片20161214100207.png-108.1kB
QQ圖片20161214121852.png-47.2kB

相關新聞

聯系我們

400-080-6560

在線咨詢:點擊這里給我發消息

郵件:[email protected]

工作時間:周一至周日,09:00-18:30

QR code