项目分步8:测试配置

作者: 大白菜的猪猪 | 来源:发表于2020-05-12 20:56 被阅读0次

测试NFS配置

在nfs服务器创建网页test.html

[root@nfs30 ~]# echo "china

no.1" > /sitedir/test.html

[root@nfs30 ~]# ls /sitedir/

test.html

[if !supportLists]2.[endif]在客户端192.168.4.50分别访问网站服务

[root@client ~]# curl

192.168.4.33/test.html

china no.1

[root@client ~]# curl 192.168.4.44/test.html

china no.1

测试MYSQL服务

1.在主数据库服务器上添加,访问数据的连接用户

mysql> create database gamedb; //建库

mysql> grant

select,insert,update,delete on gamedb.* to yaya99@"%" identified by

"123qqq...A"; //用户授权

mysql> create table

gamedb.user(name char(15)); //建表

mysql> select * from gamedb.user;

//查询表数据

Empty set (0.01 sec)

在从服务器查看是否同步数据

[root@mysql22 ~]# mysqlk -uroot -p123qqq...A

mysql> show grants for yaya99@"%"; 查看授权用户

mysql> desc gamedb.user; //查看库表

mysql> select * from gamedb.user;

Empty set (0.00 sec)

mysql> insert into gamedb.user

values("hsy"); //用来验证实现了读写分离,在从服务器上写入数据,主服务器是不会同步的

mysql> select * from gamedb.user;

mysql> select * from gamedb.user; //主服务器上没有数据

Empty set (0.00 sec)

测试读写分离服务

在网站服务器上,连接数据读写分离服务器77

[root@web33 ~]# yum -y install

mariadb 安装提供连接命令软件

[root@web44 ~]# yum -y install mariadb

[root@web33 ~]# mysql -h

192.168.4.77 -P 4006 -uyaya99 -p123qqq...A //连接读写分离服务

[root@web44 ~]# mysql -h 192.168.4.77 -P 4006 -uyaya99 -p123qqq...A

[查询数据

MySQL [(none)]> select * from gamedb.user; //显示的是从服务器上的数据

存储数据

MySQL [(none)]> insert into

gamedb.user values("lxq"); //插入数据

MySQL [(none)]> select * from gamedb.user; //查看数据

在主服务器本机登录查看数据

mysql> select * from gamedb.user;

相关文章

网友评论

    本文标题:项目分步8:测试配置

    本文链接:https://www.haomeiwen.com/subject/gywinhtx.html