查看引擎
mysql -uroot -pgoogle123 -e "show engines;"
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
| SPIDER | YES | Spider storage engine | YES | YES | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
A数据库
drop schema if exists myspider;
create schema myspider;
use myspider;
Create table tbl_a(
col_a int,
col_b int,
primary key(col_a)
) engine = Spider //启用spider引擎
Connection ' table "tbl_a", user "root", password "root" '
partition by range( col_a )
(
partition pt1 values less than (1000000) //id号10W以内在192.168.14.12机器
comment 'host "192.168.14.12", port "3306"',
partition pt1 values less than (2000000)
comment 'host "192.168.14.13", port "3306"',
partition pt2 values less than (MAXVALUE)
comment 'host "192.168.14.14", port "3306"'
);
B、C、D安装
tar -zxvf Percona-Server-5.5.22-rel25.2-237.Linux.x86_64.tar.gz
mv Percona-Server-5.5.22-rel25.2-237.Linux.x86_64 mysql
mv mysql /usr/local
cd /usr/local/mysql
cp support-files/mysql.server /etc/init.d/mysql
cp support-files/my-small.cnf /etc/my.cnf
groupadd mysql
useradd -g mysql mysql
./scripts/mysql_install_db --user=mysql
chown -R mysql /usr/local/mysql/data
chgrp -R mysql /usr/local/mysql/.
chmod 755 /etc/init.d/mysql
chkconfig --level 345 mysql on
echo "/usr/local/mysql/lib" >> /etc/ld.so.conf
ldconfig
sed -i "s#/usr/local/Percona-Server-5.5.22-rel25.2-237.Linux.x86_64#/usr/local/mysql#g" /etc/init.d/mysql
service mysql start
/usr/local/mysql/bin/mysqladmin -u root password google123
echo 'export PATH="/usr/local/mysql/bin:$PATH"' >>/etc/profile
source /etc/profile
//测试用,允许root远程防问
grant all on *.* to identified by 'root';
drop schema if exists myspider;
create schema myspider;
use myspider;
Create table tbl_a(
col_a int,
col_b int,
primary key(col_a)
) ;
A:
insert into tbl_a values (1,1);
insert into tbl_a values (1500001,2);
insert into tbl_a values (2000001,2);
可以到各个数据库查看数据的分布情况