Using Samba to provide data storage services for MySQL

Source: Internet
Author: User

Using Samba to deploy WordPress

(1) Samba server export/data/application/web, in the directory to provide WordPress;

(2) The Samba Client Mounts NFS Server exported file system to/var/www/html;

(3) the client (lamp) to deploy WordPress, and let its normal access, to ensure that the normal post, upload pictures;

(4) Client 2 (lamp), mount the file system exported by Samba server to/var/www/html; check whether its WordPress can be accessed, to ensure that the normal post, upload pictures;


Using Samba to store the data used by WordPress, the MySQL data storage directory will be shared with Samba

(1) Samba server exports the/data/directory;

(2) The Samba client mounts/data/to the local/mydata directory, and the local mysqld or MARIADB service data directory is set to/mydata, requiring the service to start normally, and to store the data normally;


Steps:


I. Deploying WordPress with Samba


1. Prepare two hosts, one host (172.16.10.17) to deploy lamp, and one host (172.16.10.77) to provide samba services

2. Deploy lamp on the 172.16.10.17 host, refer to http://11650412.blog.51cto.com/11640412/1827559

3. Configure WordPress

1) Download and unzip the WordPress package on the 172.16.10.77 host

2) Create a shared directory and copy the WordPress directory to that directory

Mkdir-pv/data/application/web

Cp-r/root/wordpress/data/application/web

3) Modify the WordPress configuration file as

Cd/data/application/web/wordpress

CP wp-config-sample.php wp-config.php

Vim wp-config.php

4. Configure Samba Services

1) Edit the configuration file, add the shared file

Vim/etc/samba/smb.conf

Add at the end of the file:

[WordPress]

comment = WordPress data # #注释信息

Path =/data/application/web/wordpress # #共享的路径

browseable = no # #不可被用户查看

writable = no # #其他用户不可写

Write list = Apache # #apache用户可写

Guest ok = no # #不允许来宾账号访问

2) Modify the permissions of the shared directory so that Apache users have read and write access to WordPress

Setfacl-m u:rwx:/data/application/web/wordpress

3) Add Apache users to Samba users

Smbpasswb-a Apache

4) Start Samba service

Systemctl Start Smb.service

Systemctl Start Nmb.service

5. Mount using Samba

Mount.cifs//172.16.10.77/wordpress/var/www/html/vhost/www2/wordpress-o Username=apache

Can be mounted after entering a password

6. Use the browser to login



Two. Use Samba to store the data used by WordPress above


1. Configure Samba Services

1) Edit the configuration file, add the shared file

Vim/etc/samba/smb.conf

Add at the end of the file:

[Mysqldata]

comment = MySQL data # #注释信息

Path =/data/mysqldata # #共享的路径

browseable = no # #不可被用户查看

writable = no # #其他用户不可写

Write list = mysql # #mysql用户可写

Guest ok = no # #不允许来宾账号访问

2) Change shared directory permissions

Chown Mysql.mysql/data/mysqldata

3) Add the MySQL user to the Samba user

Smbpasswb-a MySQL

4) Reload Samba service

Systemctl Reload Smb.service

2. Mount the use on the 172.16.10.17 host

Mount.cifs//172.16.10.77/mysqldata/data/mydata-username=mysql

You can mount the password after entering it

3. Modify the database configuration file (remember to do the backup)

Vim/etc/my.cnf

Modify its database path to/data/mydata

/datadir=/data/mydata

4. Restart the database service and log in using the browser


Using Samba to provide data storage services for MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.