可能缺少的库 libaio1
tar xvf Downloads/mysql-cluster-gpl-7.1.3-linux-x86_64-glibc23.tar.gz ln -s mysql-cluster-gpl-7.1.3-linux-x86_64-glibc23 /usr/mysqlc
mkdir my_cluster my_cluster/ndb_data my_cluster/conf
1.mgm的配置
mgm配置文件 conf/config.ini:
[ndb_mgmd] hostname=192.168.1.30 datadir=/home/ddh/my_cluster/ndb_data NodeId=1 [ndbd default] #ndb 2copy NoOfReplicas=2 DataMemory=344245094 IndexMemory=122122547 datadir=/home/ddh/my_cluster/ndb_data #BackupDataDir=/app/ndb/data/backup #LockPagesInMainMemory=1 #TimeBetweenLocalCheckpoints=20 #TimeBetweenGlobalCheckpoints=1000 #TimeBetweenEpochs=100 #TimeBetweenWatchdogCheckInitial=60000 StringMemory=20 MaxNoOfTables=1024 MaxNoOfOrderedIndexes=2048 MaxNoOfUniqueHashIndexes=512 MaxNoOfAttributes=20480 MaxNoOfTriggers=10240 #DiskCheckpointSpeedInRestart=100M #FragmentLogFileSize=256M #NoOfFragmentLogFiles=16 RedoBuffer=64M #MaxNoOfConcurrentOperations=500000 #TransactionInactiveTimeout=50000 #MaxNoOfExecutionThreads=8 #BatchSizePerLocalScan=512 ### 磁盘存储 SharedGlobalMemory=20M DiskPageBufferMemory=80M [ndbd] hostname=192.168.1.114 datadir=/var/my_cluster/ndb_data NodeId=4 [mysqld] NodeId=50 [mysqld] [mysqld] [mysqld] [mysqld]
2.ndb 只需要启动就行
./ndbd -c localhost:1186 ./ndbd -c localhost:1186
启动两个,干嘛用的?
3.mysql配置
mysql配置文件 conf/my.cnf: [mysqld] ndbcluster user=root datadir=/home/ddh/my_cluster/mysqld_data basedir=/home/ddh/mysqlc ndb-connectstring=localhost port=3307 #[mysql_cluster] #ndb-connectstring=192.168.1.30
[mysqld] ndbcluster user=root datadir=/var/my_cluster/mysqld_data basedir=/usr/local/mysqlc ndb-connectstring=192.168.1.30 port=3307 #[mysql_cluster] #ndb-connectstring=192.168.1.30
安装"mysql"数据库
cd mysqlc
scripts/mysql_install_db --no-defaults --datadir=$HOME/my_cluster/mysqld_data/
/usr/local/mysqlc/bin/mysqladmin --defaults-file=/var/my_cluster/conf/my.cnf -u root password root
运行:
cd ../my_cluster/
#第一次加上--initial
./ndb_mgmd -f conf/config.ini --initial --configdir=$HOME/my_cluster/conf/
bin/ndb_mgm -e show
#启动mysql
mysqld --defaults-file=conf/my.cnf &
#测试,创建数据库时使用
/usr/local/mysqlc/bin/mysql -h 127.0.0.1 -P 3307 -u root -p
#engine=ndb
创建表提示太长,将varchar该为longtext便可
#关闭mysql
mysqladmin --defaults-file=conf/my.cnf -uroot -proot shutdown
#关闭mgm
bin/ndb_mgm -e shutdown
问题:
ERROR 1005 (HY000): Error Can't create table 'mytable' (errno: 708)
增加MaxNoOfAttributes=5000 config.ini
[NDBD]MaxNoOfAttributes
定义了可在簇中定义的属性数目。
ERROR 1051: Unknown table 存储引擎不一样了,关闭mysql,先备份,在my.cnf中关闭存储某一存储引擎,再启动,删除表
DataMemory=1536M # How much memory to allocate for data storage
IndexMemory=768M # How much memory to allocate for index storage
MaxNoOfOrderedIndexes=800 # Default 128 (errno: 136)
MaxNoOfAttributes=8000 # Default 1000 (errno: 708)
MaxNoOfTables=600 # Default 128 (errno: 707)
#MaxNoOfUniqueHashIndexes=512 # Value from ndb_size.pl output
#MaxNoOfTriggers=2000 # Value from ndb_size.pl output