数据库
首页 > 数据库> > DNS服务器+2*LAP服务器+2*MySQL服务器+NFS服务器

DNS服务器+2*LAP服务器+2*MySQL服务器+NFS服务器

作者:互联网

在这里插入图片描述
实验需关闭firewalld和SELinux
DNS服务器:
配置文件:

[root@centos7 ~]#yum install -y bind
[root@centos7 ~]#cat /etc/named.conf 
options {
	//listen-on port 53 { 127.0.0.1; };
	listen-on-v6 port 53 { ::1; };
	directory 	"/var/named";
	dump-file 	"/var/named/data/cache_dump.db";
	statistics-file "/var/named/data/named_stats.txt";
	memstatistics-file "/var/named/data/named_mem_stats.txt";
	recursing-file  "/var/named/data/named.recursing";
	secroots-file   "/var/named/data/named.secroots";
	//allow-query     { localhost; };
	forward first;    
	forwarders { 114.114.114.114; };
	recursion yes;

//	dnssec-enable yes;
//	dnssec-validation yes;
...
}
[root@centos7 ~]#cat /etc/named.rfc1912.zones
zone "yunmix.top" IN {
	type master;
	file "yunmix.top.zone";

};
[root@centos7 ~]#cat /var/named/yunmix.top.zone 
$TTL 1D
@	IN SOA	ns.yunmix.top. admin.yunmix.top. (
					20210131	; serial
					1D	; refresh
					1H	; retry
					1W	; expire
					3H )	; minimum
@  NS  ns
ns  A  10.0.0.7
www CNAME  web
web A 10.0.0.8
web A 10.0.0.18
blog A 10.0.0.18
blog A 10.0.0.8

NFS服务器

[root@centos7 ~]#yum install nfs-utils rpcbind -y
[root@centos7 ~]#id apache
uid=48(apache) gid=48(apache) groups=48(apache)
[root@centos7 ~]#mkdir -pv /data/www/
[root@centos7 ~]#cat /etc/exports.d/apache.exports 
/data/www/ *(rw,all_squash,anonuid=48,anongid=48)

LAP服务器

[root@centos8 ~]#yum install -y httpd php-fpm php-mysqlnd php-xml
[root@centos8 ~]#cat /etc/httpd/conf.d/vhosts.conf 
<virtualhost *:80>
	documentroot /www/html/wordpress
	servername www.yunmix.top
	<directory /www/html/wordpress>
		require all granted	
	</directory>
	<ifmodule dir_module>
		directoryindex index.php index.html index.htm
		proxyRequests Off
		ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/www/html/wordpress/$1
	</ifmodule>
</virtualhost>

<virtualhost *:80>
	documentroot /www/html/forum
	servername blog.yunmix.top
	<directory /www/html/forum>
		require all granted	
	</directory>
	<ifmodule dir_module>
		directoryindex index.php index.html index.htm
		proxyRequests Off
		ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/www/html/forum/$1
	</ifmodule>
</virtualhost>
[root@centos8 ~]#mkdir -pv /www/html

[root@centos8 ~]#yum install nfs-utils -y
[root@centos8 ~]#mount 10.0.0.37:/data/www /www/html/ //永久挂载须在/etc/fstab配置

MySQL主服务器

[root@centos7 ~]#yum install mariadb-server -y
[root@centos7 ~]#cat /etc/my.cnf
[mysqld]
server-id=1
log-bin

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[root@centos7 ~]#mysqldump -A -F --single-transaction --master-data=1 > /tmp/all.mysql
[root@centos7 ~]#mysql
MariaDB [(none)]> create database ultrax;
MariaDB [(none)]> grant all on ultrax.* to forum@'10.0.0.%' identified by 'magedu';
MariaDB [(none)]> create database wordpress;
MariaDB [(none)]> grant all on wordpress.* to wordpress@'10.0.0.%' identified by 'magedu';
MariaDB [(none)]> grant replication slave on *.* to repluer@'10.0.0.%' identified by 'magedu';

MariaDB [(none)]> select user,host from mysql.user;
+-----------+--------------------+
| user      | host               |
+-----------+--------------------+
| repluer   | 10.0.0.%           |
| wordpress | 10.0.0.%           |
| forum     | 10.0.0.18          |
| forum     | 10.0.0.37          |
| root      | 127.0.0.1          |
| root      | ::1                |
|           | centos7.magedu.org |
| root      | centos7.magedu.org |
|           | localhost          |
| root      | localhost          |
+-----------+--------------------+
10 rows in set (0.00 sec)


MySQL服务器

[root@centos7 ~]#grep -i -A6 '^change master to' all.mysql 
CHANGE MASTER TO 
MASTER_HOST='10.0.0.17',
MASTER_USER='repluer',
MASTER_PASSWORD='magedu',
MASTER_PORT=3306,
MASTER_LOG_FILE='mariadb-bin.000002', MASTER_LOG_POS=245;
[root@centos7 ~]#mysql < all.mysql 
[root@centos7 ~]#mysql
MariaDB [(none)]> start slave;

标签:10.0,named,root,www,centos7,NFS,var,服务器,LAP
来源: https://blog.csdn.net/weixin_50904580/article/details/113513776