中文字幕理论片,69视频免费在线观看,亚洲成人app,国产1级毛片,刘涛最大尺度戏视频,欧美亚洲美女视频,2021韩国美女仙女屋vip视频

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
應(yīng)用系統(tǒng)分布式構(gòu)建運(yùn)維

應(yīng)用系統(tǒng)分布式構(gòu)建運(yùn)維

1 x初級(jí),項(xiàng)目四

部署主從數(shù)據(jù)庫(kù)

基礎(chǔ)環(huán)境安裝

準(zhǔn)備兩臺(tái)主機(jī)

修改主機(jī)名

#?hostnamectl set-hostname mysql1

# hostnamectl set-hostname mysql2

關(guān)閉防火墻及SELinux服務(wù)(兩個(gè)節(jié)點(diǎn))

#?setenforce 0

#?systemctl stop firewalld

配置hosts文件(兩個(gè)節(jié)點(diǎn))

# vi /etc/hosts

加入以下內(nèi)容

192.168.37.16 mysql1
192.168.37.17 mysql2

安裝數(shù)據(jù)庫(kù)服務(wù)(兩個(gè)節(jié)點(diǎn))

#?yum install -y mariadb mariadb-server

啟動(dòng)數(shù)據(jù)庫(kù)服務(wù)并設(shè)置開(kāi)機(jī)自啟

# systemctl start mariadb
# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

初始化數(shù)據(jù)庫(kù)并配置主從服務(wù)

初始化數(shù)據(jù)庫(kù)(兩個(gè)節(jié)點(diǎn))

# mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
????? SERVERS IN PRODUCTION USE!? PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the current
password for the root user.? If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.Enter current password for root (enter for none): ? ? ? ? ? ?? ##默認(rèn)按回車
OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.Set root password? [Y/n] y
New password: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ##輸入數(shù)據(jù)庫(kù)root密碼Re-enter new password:
Password updated successfully!
Reloading privilege tables..
?... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.? This is intended only for testing, and to make the installation
go a bit smoother.? You should remove them before moving into a
production environment.Remove anonymous users? [Y/n] y
?... Success!Normally, root should only be allowed to connect from 'localhost'.? This
ensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] n
?... skipping.By default, MariaDB comes with a database named 'test' that anyone can
access.? This is also intended only for testing, and should be removed
before moving into a production environment.Remove test database and access to it? [Y/n] y
?- Dropping test database...
?... Success!
?- Removing privileges on test database...
?... Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.Reload privilege tables now? [Y/n] y
?... Success!Cleaning up...All done!? If you've completed all of the above steps, your MariaDB
installation should now be secure.Thanks for using MariaDB!

配置mysql1主節(jié)點(diǎn)

修改mysql1節(jié)點(diǎn)的數(shù)據(jù)庫(kù)配置文件

# vi /etc/my.cnf

[mysqld]
log_bin=mysql-bin ? ? ? ? ? ? ?? ##記錄操作日志
binlog_ignore_db=mysql ? ?? ##不同步mysql系統(tǒng)數(shù)據(jù)庫(kù)
server_id=16 ? ? ? ? ? ? ? ? ? ? ?? ##數(shù)據(jù)庫(kù)集群中的每個(gè)節(jié)點(diǎn)id都要不同
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

重啟數(shù)據(jù)庫(kù)服務(wù)

# systemctl restart mariadb

進(jìn)入數(shù)據(jù)庫(kù)

# mysql -uroot -p123456

授權(quán)在任何客戶端機(jī)器上可以以root用戶登錄到數(shù)據(jù)庫(kù)

> grant all privileges on *.* to root@'%' identified by "123456";

在主節(jié)點(diǎn)上創(chuàng)建一個(gè)用戶連接節(jié)點(diǎn)mysql2,并賦予從節(jié)點(diǎn)同步主節(jié)點(diǎn)數(shù)據(jù)庫(kù)的權(quán)限

> grant replication slave on *.* to 'user'@'mysql2' identified by '123456';

配置mysql2從節(jié)點(diǎn)

修改mysql2節(jié)點(diǎn)的數(shù)據(jù)庫(kù)配置文件

# vi /etc/my.cnf

[mysqld]
log_bin=mysql-bin ? ? ? ? ? ? ?? ##記錄操作日志
binlog_ignore_db=mysql ? ?? ##不同步mysql系統(tǒng)數(shù)據(jù)庫(kù)
server_id=17 ? ? ? ? ? ? ? ? ? ? ?? ##數(shù)據(jù)庫(kù)集群中的每個(gè)節(jié)點(diǎn)id都要不同
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

重啟數(shù)據(jù)庫(kù)服務(wù)

# systemctl restart mariadb

進(jìn)入數(shù)據(jù)庫(kù)

# mysql -uroot -p123456

配置從節(jié)點(diǎn)連接主節(jié)點(diǎn)的連接信息

> change master to master_host='mysql1',master_user='user',master_password='123456';

開(kāi)啟從節(jié)點(diǎn)服務(wù)

> start slave;

查看從節(jié)點(diǎn)服務(wù)狀態(tài)

> show slave status\G

配置數(shù)據(jù)庫(kù)主從集群成功

驗(yàn)證數(shù)據(jù)庫(kù)主從服務(wù)

主節(jié)點(diǎn)創(chuàng)建數(shù)據(jù)庫(kù)

在主節(jié)點(diǎn)中創(chuàng)建庫(kù)

> create database test;

> use test;

在庫(kù)中創(chuàng)建表

> create table company(id int not null primary key,name varchar(50),addr varchar(255));

插入表數(shù)據(jù)

> insert into company values(1,"alibaba","china");

查看表數(shù)據(jù)

> select * from company;

從節(jié)點(diǎn)驗(yàn)證復(fù)制功能

查看數(shù)據(jù)庫(kù)列表

> show databases;

> use test;

查詢表

> show tables;

查詢內(nèi)容,驗(yàn)證復(fù)制功能

> select * from company;

?

驗(yàn)證從數(shù)據(jù)庫(kù)的復(fù)制功能成功

部署Nginx服務(wù)

基礎(chǔ)環(huán)境安裝

修改主機(jī)名

# hostnamectl set-hostname nginx

關(guān)閉防火墻及SELinux服務(wù)

#?setenforce 0

#?systemctl stop firewalld

安裝配置基礎(chǔ)服務(wù)

編譯安裝基礎(chǔ)環(huán)境

# yum install -y gcc gcc-c openssl-devel zlib-devel zlib pcre-devel

創(chuàng)建指定用戶

# groupadd -g 1001 nginx
# useradd -u 900 nginx -g nginx -s /sbin/nologin
# tail -1 /etc/passwd
nginx:x:900:1001::/home/nginx:/sbin/nologin

安裝配置nginx服務(wù)

將提供的nginx-1.12.2.tar.gz壓縮包上傳至/usr/local/src/目錄下,并解壓到當(dāng)前目錄

# cd /usr/local/src

# tar -zxvf nginx-1.12.2.tar.gz

編譯并安裝

# cd nginx-1.12.2

# ./configure --prefix=/usr/local/nginx --with-http_dav_module \
> --with-http_stub_status_module --with-http_addition_module \
> --with-http_sub_module --with-http_flv_module --with-http_mp4_module \
> --with-http_ssl_module --with-http_gzip_static_module --user=nginx --group=nginx

沒(méi)有報(bào)錯(cuò),進(jìn)行安裝

# make && make install

創(chuàng)建軟鏈接

# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/

啟動(dòng)測(cè)試

# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

# nginx

# netstat -ntpl

80端口啟動(dòng),表示nginx服務(wù)啟動(dòng)成功?

安裝PHP環(huán)境

基礎(chǔ)環(huán)境安裝

修改主機(jī)名

# hostnamectl set-hostname php

關(guān)閉防火墻及SELinux服務(wù)

#?setenforce 0

#?systemctl stop firewalld

安裝配置基礎(chǔ)服務(wù)

編譯安裝基礎(chǔ)環(huán)境

# yum install -y gcc gcc-c libxml2-devel libcurl-devel openssl-devel bzip2-devel

將提供的libmcrypt-2.5.8.tar.gz壓縮包上傳至/usr/local/src目錄下,并解壓到當(dāng)前目錄

# cd /usr/local/src

# tar -zxvf libmcrypt-2.5.8.tar.gz

編譯安裝服務(wù)

# cd libmcrypt-2.5.8

# ./configure --prefix=/usr/local/libmcrypt && make && make install

安裝PHP環(huán)境

將提供的php-5.6.27.tar.gz壓縮包上傳至/usr/local/src目錄下,并解壓到當(dāng)前目錄

# cd /usr/local/src/

# tar -zxvf php-5.6.27.tar.gz

編譯安裝服務(wù)

# cd php-5.6.27

# ./configure --prefix=/usr/local/php5.6 --with-mysql=mysqlnd \

--with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-fpm \

--enable-sockets --enable-sysvshm --enable-mbstring --with-freetype-dir \

--with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-mhash \

--with-mcrypt=/usr/local/libmcrypt --with-config-file-path=/etc \

--with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts

沒(méi)有報(bào)錯(cuò),進(jìn)行安裝

# make && make install

創(chuàng)建用戶ID

這個(gè)nginx的id號(hào)要和nginx主機(jī)上的保持一致

# groupadd -g 1001 nginx
# useradd -u 900 nginx -g nginx -s /sbin/nologin
# tail -1 /etc/passwd
nginx:x:900:1001::/home/nginx:/sbin/nologin

配置PHP環(huán)境

PHP壓縮包中提供了PHP環(huán)境需要用到的模板文件,需要對(duì)文件進(jìn)行改名后才能使用

復(fù)制文件并改名

# cp php.ini-production /etc/php.ini

# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

賦予文件執(zhí)行權(quán)限

# chmod x /etc/init.d/php-fpm

添加PHP服務(wù)到啟動(dòng)列表,并設(shè)置開(kāi)機(jī)自啟

# chkconfig --add php-fpm

# chkconfig php-fpm on

修改PHP的主配置文件

# cp /usr/local/php5.6/etc/php-fpm.conf.default /usr/local/php5.6/etc/php-fpm.conf

# grep -n '^'[a-Z] /usr/local/php5.6/etc/php-fpm.conf
149:user = nginx
150:group = nginx
164:listen = 192.168.37.13:9000
224:pm = dynamic
235:pm.max_children = 50
240:pm.start_servers = 5
245:pm.min_spare_servers = 5
250:pm.max_spare_servers = 35

啟動(dòng)PHP服務(wù)

啟動(dòng)PHP服務(wù)

# service php-fpm start
Starting php-fpm? done

查看啟動(dòng)狀態(tài)

# netstat -ntpl

9000端口啟動(dòng),表示PHP環(huán)境安裝完畢?

分布式部署LNMP WordPress

已經(jīng)完成了主從數(shù)據(jù)庫(kù)的安裝配置、Nginx服務(wù)的安裝、PHP環(huán)境的安裝的四臺(tái)機(jī)器進(jìn)行部署

分布式LNMP環(huán)境的調(diào)試

配置Nginx服務(wù)支持PHP環(huán)境(nginx節(jié)點(diǎn))

修改配置文件

# vi /usr/local/nginx/conf/nginx.conf

location / {
??????????? root?? /www; ? ? ? ? ? ? ? ? ? ##更改網(wǎng)頁(yè)目錄
??????????? index? index.php index.html index.htm;
??????? }

location ~ \.php$ { ? ? ? ? ? ? ? ? ? ? ? ##去掉這部分前面的注釋符
??????????? root?????????? /www; ? ? ? ? ? ? ##更改目錄 ? ? ??
??????????? fastcgi_pass?? 192.168.37.13:9000; ? ? ? ? ? ##添加PHP主機(jī)IP地址
??????????? fastcgi_index? index.php;
??????????? fastcgi_param? SCRIPT_FILENAME? /scripts$fastcgi_script_name;
??????????? include??????? fastcgi_params;
??????? }

添加配置

# vi /usr/local/nginx/conf/fastcgi_params

fastcgi_param? SCRIPT_NAME??????? $fastcgi_script_name;
fastcgi_param? SCRIPT_FILENAME??? $document_root$fastcgi_script_name; ? ? ##添加這行
fastcgi_param? REQUEST_URI??????? $request_uri;

創(chuàng)建目錄(nginx和php節(jié)點(diǎn))

在nginx和php節(jié)點(diǎn),創(chuàng)建/www目錄,并修改用戶和用戶組

# mkdir /www

# chown nginx:nginx /www/

部署WordPress(nginx和php節(jié)點(diǎn))

將提供的wordpress-4.7.3-zh_CN.zip壓縮包上傳至nginx節(jié)點(diǎn)和php節(jié)點(diǎn)的/root目錄下并解壓

# yum install -y unzip

# unzip wordpress-4.7.3-zh_CN.zip

將解壓后的文件復(fù)制到/www目錄下

# mv wordpress/* /www/

修改wordpress的配置文件(nginx節(jié)點(diǎn))

將模板文件復(fù)制并修改

# cp /www/wp-config-sample.php /www/wp-config.php?

# vi /www/wp-config.php

// ** MySQL 設(shè)置 - 具體信息來(lái)自您正在使用的主機(jī) ** //
/** WordPress數(shù)據(jù)庫(kù)的名稱 */
define('DB_NAME', 'wordpress');/** MySQL數(shù)據(jù)庫(kù)用戶名 */
define('DB_USER', 'root');/** MySQL數(shù)據(jù)庫(kù)密碼 */
define('DB_PASSWORD', '123456');/** MySQL主機(jī) */
define('DB_HOST', '192.168.37.16'); ? ? ? ? ? ? ? ##此處IP為mysql1的地址/** 創(chuàng)建數(shù)據(jù)表時(shí)默認(rèn)的文字編碼 */
define('DB_CHARSET', 'utf8');/** 數(shù)據(jù)庫(kù)整理類型。如不確定請(qǐng)勿更改 */
define('DB_COLLATE', '');將該配置文件復(fù)制到php節(jié)點(diǎn)(nginx節(jié)點(diǎn))# scp /www/wp-config.php root@192.168.37.13:/www/
The authenticity of host '192.168.37.13 (192.168.37.13)' can't be established.
ECDSA key fingerprint is SHA256:C2d2Z sCPaySJhwUjJ6I9fcmVW/rCBNL/7qI4lm8fd8.
ECDSA key fingerprint is MD5:84:3a:fb:c4:c1:15:b6:99:6f:62:f9:4b:46:a4:60:8c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.37.13' (ECDSA) to the list of known hosts.
root@192.168.37.13's password: ? ? ? ? ? ? ? ? ? ? ?? ##輸入PHP節(jié)點(diǎn)密碼
wp-config.php?????????????????????????????????? 100% 2909???? 1.9MB/s?? 00:00

創(chuàng)建WordPress數(shù)據(jù)庫(kù)(mysql1節(jié)點(diǎn))

登錄數(shù)據(jù)庫(kù)

# mysql -uroot -p123456

創(chuàng)建數(shù)據(jù)庫(kù)

> create database wordpress;

驗(yàn)證WordPress應(yīng)用(nginx節(jié)點(diǎn))

重啟nginx服務(wù)

# nginx -s reload

使用網(wǎng)頁(yè)訪問(wèn)192.168.37.12(nginx節(jié)點(diǎn)ip)

填寫(xiě)信息之后點(diǎn)擊左下角安裝

進(jìn)入后臺(tái)界面

點(diǎn)擊左上角圖標(biāo)

?

?

?分布式部署完成

來(lái)源:https://www.icode9.com/content-4-690451.html
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
就這22步讓你在30分鐘內(nèi)完成wordpress網(wǎng)站三位搭建
樹(shù)莓派搭建網(wǎng)站
神器Termux的使用記錄 | 風(fēng)與牧歌
CentOS 7源碼編譯安裝最新版php5.6和nginx1.7.9及mysql(搭建lnmp環(huán)境) – 飛嗨
在群暉NAS中搭建WordPress站點(diǎn)的方法
LNMP相關(guān)軟件目錄及文件位置
更多類似文章 >>
生活服務(wù)
熱點(diǎn)新聞
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服