自考在线做试卷的网站,西陆网,多用户 wordpress,wordpress salientmycat三个配置文件位于conf下 可通过Notepad操作
首先配置service.xml中的user标签#xff0c;设置用户名#xff0c;密码#xff0c;查询权限#xff0c;是否只读等
只是设置了root用户#xff0c;有所有权限
配置schema.xml
?xml version1.0?操作
首先配置service.xml中的user标签设置用户名密码查询权限是否只读等
只是设置了root用户有所有权限
配置schema.xml
?xml version1.0?
!DOCTYPE mycat:schema SYSTEM schema.dtd
mycat:schema xmlns:mycathttp://io.mycat/schema namemodel checkSQLschematrue sqlMaxLimit100table nametest_table dataNodedn1,dn2 rulemod-long //schemadataNode namedn1 dataHostdata223 databasemodel /dataNode namedn2 dataHostdata224 databasemodel /dataHost namedata223 maxCon1000 minCon10 balance0writeType0 dbTypemysql dbDriverjdbc switchType1 slaveThreshold100heartbeatselect user()/heartbeatwriteHost hosthostS1 urljdbc:mysql://ip地址:3306?useSSLfalseamp;serverTimezoneAsia/Shanghaiamp;characterEncodingutf8 userroot passwordroot //dataHostdataHost namedata224 maxCon1000 minCon10 balance0writeType0 dbTypemysql dbDriverjdbc switchType1 slaveThreshold100heartbeatselect user()/heartbeatwriteHost hosthostS2 urljdbc:mysql://ip地址:3306?useSSLfalseamp;serverTimezoneAsia/Shanghaiamp;characterEncodingutf8 userroot passwordroot //dataHost/mycat:schema关闭服务器的防火墙或者开通对应的端口
mysql中配置文件my.cnf添加
net_read_timeout 120
net_write_timeout 900启动mycat后进行测试
连接mycat
mysql -u用户名 -p密码 -P 端口 -h ip地址
mysql -uroot -proot -P 8066 -h ip地址查询库 show databases; 切换到 model 数据库 use model; 查看表 show tables; 查询
根据配置的规则两个节点每个节点数据库两条数据
节点1 节点2