sudo tee -a /etc/yum.repos.d/mysql-community.repo << EOF [mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/\$basearch/ enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql EOF
#修改schema.xml(配置逻辑库下的逻辑表,已经数据存放的mysql节点) <schemaname="bigdata"checkSQLschema="false"sqlMaxLimit="100"> <!-- auto sharding by id (long) --> <tablename="travelrecord"dataNode="dn1,dn2,dn3"rule="auto-sharding-long" />
<!-- global table is auto cloned to all defined data nodes ,so can join with any table whose sharding node is in the same data node --> <tablename="company"primaryKey="ID"type="global"dataNode="dn1,dn2,dn3" />
<!-- random sharding using mod sharind rule --> <tablename="hotnews"primaryKey="ID"autoIncrement="true"dataNode="dn1,dn2,dn3" rule="mod-long" /> </schema>
<dataHostname="cs4"maxCon="1000"minCon="10"balance="0" writeType="0"dbType="mysql"dbDriver="native"switchType="1"slaveThreshold="100"> <heartbeat>select user()</heartbeat> <!-- can have multi write hosts --> <writeHosthost="hostM1"url="192.168.170.134:3306"user="root"password="XiaoNiu_123!"> </writeHost> </dataHost>
<dataHostname="cs5"maxCon="1000"minCon="10"balance="0" writeType="0"dbType="mysql"dbDriver="native"switchType="1"slaveThreshold="100"> <heartbeat>select user()</heartbeat> <!-- can have multi write hosts --> <writeHosthost="hostM1"url="192.168.170.135:3306"user="root"password="XiaoNiu_123!"> </writeHost> </dataHost>
<dataHostname="cs6"maxCon="1000"minCon="10"balance="0" writeType="0"dbType="mysql"dbDriver="native"switchType="1"slaveThreshold="100"> <heartbeat>select user()</heartbeat> <!-- can have multi write hosts --> <writeHosthost="hostM1"url="192.168.170.136:3306"user="root"password="XiaoNiu_123!"> </writeHost> </dataHost>