linux營運、架構之路-資料庫遷移

來源:互聯網
上載者:User

標籤:fastcgi   host   服務   程式   cal   解析   word   獨立   hosts   

一、wordpress搭建

1、wordpress下載部署

cd /server/tools/wget https://cn.wordpress.org/wordpress-4.8.1-zh_CN.tar.gztar xf wordpress-4.8.1-zh_CN.tar.gzmv wordpress/* /application/nginx/html/blog/chown -R www.www /application/nginx/html/blog/注意:確認hosts檔案進行瞭解析瀏覽器頁面輸入blog.etiantian.org/進行wordpress部署        vim wp-config.php可以修改wordpress上的資料庫連接參數資訊

2、資料庫建立管理wordpress使用者及授權

create database wordpress;grant all on wordpress.* to ‘wordpress‘@‘172.16.1.%‘ identified by ‘123456‘;select user,host from mysql.user;grant all on wordpress.* to ‘wordpress‘@‘localhost‘ identified by ‘123456‘;flush privileges;

3、 搭建網站基本流程

①要有網站代碼(向開發人員要)

wordpress Discuz DedeCMS……等開源軟體

②進入到代碼程式目錄中,將代碼資訊移動到網站目錄下

mv ./* /application/nginx/html/blog/

③修改網站目錄許可權

chown -R www.www /application/nginx/html/blog/

④進行網站初始化

create database wordpress;grant all on wordpress.* to ‘wordpress‘@‘172.16.1.%‘ identified by ‘oldboy123‘;grant all on wordpress.* to ‘wordpress‘@‘localhost‘ identified by ‘oldboy123‘;flush privileges;

二、資料庫遷移

1、備份web01資料庫資料

mysqldump -uroot -p123456 --all-databases >/tmp/bak_$(date +%F).sql

2、把備份到的資料遠程拷貝到獨立資料庫db01(172.16.1.51)上面

scp -rp /tmp/bak_2017-09-25.sql 172.16.1.51:/tmp/

3、db01匯入數備份的據庫資訊

mysql -uroot -p123456 </tmp/bak_2017-09-25.sqlflush privileges;

4、資料庫遷移完畢,修改網站串連資料庫的設定檔

vi wp-config.php 註:修改localhost為遠程db01的資料庫IP地址此時web伺服器的資料庫就可以停止服務了,至此資料庫遷移完畢

三、網站資料移轉到NFS共用目錄

1、將原有目錄中的資料移出

/application/nginx/html/blog/wp-contentmkdir /tmp/wordpress_backup -pmv uploads/* /tmp/wordpress_backup/

2、NFS伺服器上面配置建立共用目錄

echo "/data 172.16.1.0/24(rw,sync,all_squash)" >>/etc/exports/etc/init.d/nfs restartshowmount -e 172.16.1.31mount -t nfs 172.16.1.31:/data /application/nginx/html/blog/wp-content/uploads/mv /tmp/wordpress_backup/* .

3、wordpress部落格網站設定檔

[[email protected] extra]# cat blog.conf     server {        listen       80;        server_name  blog.etiantian.org;        location / {            root   html/blog;            index index.php index.html index.htm;        }        location ~ .*\.(php|php5)?$ {            root   html/blog;            fastcgi_pass  127.0.0.1:9000;            fastcgi_index index.php;            include fastcgi.conf;        }    }

4、其它bbs、cms網站搭建類似

 

linux營運、架構之路-資料庫遷移

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.