LNMP service environment on a single machine (ip:125), now to migrate the MySQL service (ip:129), the image files to the NFS server (ip:130)
MySQL server (129)
Install the MySQL configuration process (download slightly)
Useradd mysql-s/sbin/nologin-Mmkdir-P/ApplicationTarXF mysql-5.5. --LINUX-GLIBC2. A-x86_64.Tar. GZMVmysql-5.5. --LINUX-GLIBC2. A-x86_64/application/mysql-5.5. -LN-s/application/mysql-5.5. -//application/MySQLChown-R mysql.mysql/application/MYSQLCD/application/MySQL./scripts/mysql_install_db--user=mysql--basedir=/application/mysql--datadir=/application/mysql/data/CP./support-files/my-small.cnf/etc/my.cnfCPsupport-files/mysql.server/etc/init.d/mysqldsed-I.'s#/usr/local/mysql#/application/mysql#g'/etc/my.cnf/etc/init.d/mysqld/application/mysql/bin/mysqld_safe
/etc/init.d/mysqld start
lsof-i:3306
Cp-a/application/mysql/bin/*/usr/local/sbin/
Mysqladmin-uroot Password 123456
LNMP environment to export data in MySQL (ip:125)
Mysqldump-uroot-p123456-b WordPress | gzip>bak.sql.gzSCP bak.sql.gz [email protected]192.168. 70.129:/tmp
Import to MySQL server (129)
gzip -
Login Database View
Mysql> show databases; +--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema | | Test | | WordPress |+--------------------+5 in Set (0.00 sec) database grants LNMP access to grant all on WordPress . * to [email protected]'192.168.70.%'123456'; flush privileges;
Stop the database in LNMP (125)
/etc/init.d/mysqld stop
Modify WordPress Files (125)
cd/application/nginx/html/blog/vim WP-config.php
/** MySQL Host */
Define (' Db_host ', ' 192.168.70.129 ');
This gives you access to the
Blog.daxian.com
Test MySQL in a blog
Post a blog post
Viewing the 129 database
Select*From daxian_posts\g***************************8. Row ***************************ID:8Post_author:1post_date:2018- Geneva- - -:xx: -POST_DATE_GMT:0000-xx-xx xx:xx:xxPost_content:post_title:123456daxian
Success
========================== picture separated to nfs=================
The picture position is
tree/application/nginx/html/blog/wp-content/uploads/WP-content/uploads/└──2018└── Geneva├──m2w500hq85lt_x_large_eqqd_500c000026851262-100x100. jpg├──m2w500hq85lt_x_large_eqqd_500c000026851262-150x150. jpg├──m2w500hq85lt_x_large_eqqd_500c000026851262-300x194. jpg├──m2w500hq85lt_x_large_eqqd_500c000026851262.jpg├──m2w500hq85lt_x_large_viqg_741d00001d1f1262-100x100. jpg├──m2w500hq85lt_x_large_viqg_741d00001d1f1262-150x150. jpg├──m2w500hq85lt_x_large_viqg_741d00001d1f1262-300x216. Jpg└──m2w500hq85lt_x_large_viqg_741d00001d1f1262.jpg
Create a user on an NFS server
506 www (see 125 www user uid number)
Install NFS (both client and server are installed))
Yum Install nfs-utils rpcbind-y
Start on NFS
/etc/init.d/rpcbind start/etc/init.d/nfs start
Rpcinfo-p localhost
Mkdir/data/blog-p
Chown-r Www.www/data
Vim/etc/exports
/data 192.168.70.0/24 (rw,sync,all_squash,anonuid=506,anongid=506)
Restart NFS
/etc/init.d/nfs Reload
SHOWMOUNT-E 192.168.70.130
Client Startup (125)
/etc/init.d/rpcbind start
SHOWMOUNT-E 192.168.70.130
Export list for 192.168.70.130:
/data 192.168.70.0/24
Move the old data away (125
cd/application/nginx/html/blog/wp-content/uploadsmv2018 /tmp
Mount
Mount 192.168. 70.130:/data/nfs-blog/application/nginx/html/blog/wp-content/uploads/
Move the data back
CP -a/tmp/2018/.
Complete MySQL separation and picture separation
It can be viewed on NFS again.
pwd/data/nfs-blog/2018/02
Ls
M2w500hq85lt_x_large_eqqd_500c000026851262-100x100.jpg
M2w500hq85lt_x_large_eqqd_500c000026851262-150x150.jpg
M2w500hq85lt_x_large_eqqd_500c000026851262-300x194.jpg
M2w500hq85lt_x_large_eqqd_500c000026851262.jpg
M2w500hq85lt_x_large_viqg_741d00001d1f1262-100x100.jpg
M2w500hq85lt_x_large_viqg_741d00001d1f1262-1-100x100.jpg
M2w500hq85lt_x_large_viqg_741d00001d1f1262-1-150x150.jpg
M2w500hq85lt_x_large_viqg_741d00001d1f1262-1-300x216.jpg
M2w500hq85lt_x_large_viqg_741d00001d1f1262-150x150.jpg
M2w500hq85lt_x_large_viqg_741d00001d1f1262-1.jpg
M2w500hq85lt_x_large_viqg_741d00001d1f1262-300x216.jpg
M2w500hq85lt_x_large_viqg_741d00001d1f1262.jpg
Install PHP and build a blog (iii) Service migration separation