- 浏览: 739167 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
lgh1992314:
a offset: 26b offset: 24c offse ...
java jvm字节占用空间分析 -
ls0609:
语音实现在线听书http://blog.csdn.net/ls ...
Android 语音输入API使用 -
wangli61289:
http://viralpatel-net-tutorials ...
Android 语音输入API使用 -
zxjlwt:
学习了素人派http://surenpi.com
velocity宏加载顺序 -
tt5753:
谢啦........
Lucene的IndexWriter初始化时的LockObtainFailedException的解决方法
1.到mysql网站下载mysql cluster版本 http://www.mysql.com/downloads/cluster/
下载到/home/weijianzhongwj/software下
2.安装mysql cluster
cd /home/weijianzhongwj/software
tar xvf mysql-cluster-gpl-7.2.8-linux2.6-i686.tar.gz
ln -s mysql-cluster-gpl-7.2.8-linux2.6-i686 mysqlc
在$HOME/.bashrc增加 export PATH=$PATH:/home/weijianzhongwj/software/mysqlc/bin 一行,添加mysql的bin目录到path路径中
3.对于一个mysql集群,我们需要启动一个mysql server(mysqld),两个data nodes(NDB),还有一个管理结点(ndb_mgmd),我们测试是在单机中,对于在多台机器上,在data nodes配置的hostname修改为对应机器的ip则可。
我们先来添加爱mysql集群需要的配置文件
先进入mysqlc的目录,在这个目录下创建配置文件目录和数据文件目录
cd /home/weijianzhongwj/software/mysqlc mkdir my_cluster my_cluster/ndb_data my_cluster/mysqld_data my_cluster/conf
然后在my_cluster/conf中创建下面两个文件:
my.cnf
[mysqld] ndbcluster datadir=/home/weijianzhongwj/software/mysqlc/my_cluster/mysqld_data basedir=/home/weijianzhongwj/software/mysqlc port=5000
config.ini
[ndb_mgmd] hostname=localhost datadir=/home/weijianzhongwj/software/mysqlc/my_cluster/ndb_data NodeId=1 [ndbd default] noofreplicas=2 datadir=/home/weijianzhongwj/software/mysqlc/my_cluster/ndb_data [ndbd] hostname=localhost NodeId=3 [ndbd] hostname=localhost NodeId=4 [mysqld] NodeId=50
然后在mysqlc的目录下,创建名称为mysql数据库,这是所有mysql需要创建的数据库
cd /home/weijianzhongwj/software/mysqlc/ scripts/mysql_install_db --no-defaults --datadir=/home/weijianzhongwj/software/mysqlc//my_cluster/mysqld_data/
4.启动管理结点,数据结点,mysql server
weijianzhongwj@ubuntu:~/software/mysqlc$ bin/ndb_mgmd -f my_cluster/conf/config.ini --initial --configdir=/home/weijianzhongwj/software/mysqlc/my_cluster/conf/ MySQL Cluster Management Server mysql-5.5.27 ndb-7.2.8 weijianzhongwj@ubuntu:~/software/mysqlc$ ps aufx|grep ndb 1000 2352 0.0 0.0 2256 316 ? S 21:18 0:00 \_ /usr/lib/chromium-browser/chromium-browser-sandbox /usr/lib/chromium-browser/chromium-browser --type=zygote 1000 3286 0.0 0.0 5832 840 pts/3 S+ 21:52 0:00 \_ grep --color=auto ndb 1000 3275 0.4 0.0 35964 2504 ? Ssl 21:52 0:00 bin/ndb_mgmd -f my_cluster/conf/config.ini --initial --configdir=/home/weijianzhongwj/software/mysqlc/my_cluster/conf/ weijianzhongwj@ubuntu:~/software/mysqlc$ bin/ndbd -c localhost:1186 2012-11-08 21:53:12 [ndbd] INFO -- Angel connected to 'localhost:1186' 2012-11-08 21:53:12 [ndbd] INFO -- Angel allocated nodeid: 3 weijianzhongwj@ubuntu:~/software/mysqlc$ bin/ndbd -c localhost:1186 2012-11-08 21:53:14 [ndbd] INFO -- Angel connected to 'localhost:1186' 2012-11-08 21:53:14 [ndbd] INFO -- Angel allocated nodeid: 4 weijianzhongwj@ubuntu:~/software/mysqlc$ ps aufx|grep ndbd 1000 3395 0.0 0.0 5832 836 pts/3 S+ 21:53 0:00 \_ grep --color=auto ndbd 1000 3316 0.0 0.0 19544 2284 ? Ss 21:53 0:00 bin/ndbd -c localhost:1186 1000 3317 2.9 5.8 514332 479652 ? Sl 21:53 0:00 \_ bin/ndbd -c localhost:1186 1000 3355 0.0 0.0 19544 2284 ? Ss 21:53 0:00 bin/ndbd -c localhost:1186 1000 3356 3.3 5.8 514200 479260 ? Sl 21:53 0:00 \_ bin/ndbd -c localhost:1186 weijianzhongwj@ubuntu:~/software/mysqlc$ bin/ndb_mgm -e show Connected to Management Server at: localhost:1186 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=3 @127.0.0.1 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0, Master) id=4 @127.0.0.1 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0) [ndb_mgmd(MGM)] 1 node(s) id=1 @127.0.0.1 (mysql-5.5.27 ndb-7.2.8) [mysqld(API)] 1 node(s) id=50 (not connected, accepting connect from any host) weijianzhongwj@ubuntu:~/software/mysqlc$ bin/mysqld --defaults-file=/home/weijianzhongwj/software/mysqlc/my_cluster/conf/my.cnf & [1] 3449 weijianzhongwj@ubuntu:~/software/mysqlc$ 121108 21:54:50 [Note] Plugin 'FEDERATED' is disabled. 121108 21:54:50 InnoDB: The InnoDB memory heap is disabled 121108 21:54:50 InnoDB: Mutexes and rw_locks use InnoDB's own implementation 121108 21:54:50 InnoDB: Compressed tables use zlib 1.2.3 121108 21:54:50 InnoDB: Using Linux native AIO 121108 21:54:50 InnoDB: Initializing buffer pool, size = 128.0M 121108 21:54:50 InnoDB: Completed initialization of buffer pool 121108 21:54:50 InnoDB: highest supported file format is Barracuda. 121108 21:54:51 InnoDB: Waiting for the background threads to start 121108 21:54:52 InnoDB: 1.1.8 started; log sequence number 1595675 121108 21:54:52 [Note] NDB: NodeID is 50, management server 'localhost:1186' 121108 21:54:53 [Note] NDB[0]: NodeID: 50, all storage nodes connected 121108 21:54:53 [Warning] NDB: server id set to zero - changes logged to bin log with server id zero will be logged with another server id by slave mysqlds 121108 21:54:53 [Note] Starting Cluster Binlog Thread 121108 21:54:53 [Note] Server hostname (bind-address): '0.0.0.0'; port: 5000 121108 21:54:53 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 121108 21:54:53 [Note] Server socket created on IP: '0.0.0.0'. 121108 21:54:53 [Note] Event Scheduler: Loaded 0 events 121108 21:54:53 [Note] bin/mysqld: ready for connections. Version: '5.5.27-ndb-7.2.8-cluster-gpl' socket: '/tmp/mysql.sock' port: 5000 MySQL Cluster Community Server (GPL) 121108 21:54:54 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$mysql/ndb_schema 121108 21:54:54 [Note] NDB Binlog: logging ./mysql/ndb_schema (UPDATED,USE_WRITE) 121108 21:54:54 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$mysql/ndb_apply_status 121108 21:54:54 [Note] NDB Binlog: logging ./mysql/ndb_apply_status (UPDATED,USE_WRITE) 121108 21:54:54 [Note] NDB: Cleaning stray tables from database 'information_schema' 121108 21:54:54 [Note] NDB: Cleaning stray tables from database 'ndbinfo' 121108 21:54:54 [Note] NDB: Cleaning stray tables from database 'performance_schema' 121108 21:54:54 [Note] NDB: Cleaning stray tables from database 'test' 2012-11-08 21:54:54 [NdbApi] INFO -- Flushing incomplete GCI:s < 1320/5 2012-11-08 21:54:54 [NdbApi] INFO -- Flushing incomplete GCI:s < 1320/5 121108 21:54:54 [Note] NDB Binlog: starting log at epoch 1320/5 121108 21:54:54 [Note] NDB Binlog: ndb tables writable
5.测试
weijianzhongwj@ubuntu:~/software/mysqlc$ bin/mysql -h 127.0.0.1 -P 5000 -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.5.27-ndb-7.2.8-cluster-gpl MySQL Cluster Community Server (GPL) Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database clusterdb;use clusterdb; Query OK, 1 row affected (0.06 sec) Database changed mysql> create table simples (id int not null primary key) engine=ndb; 121108 21:55:56 [Note] NDB Binlog: CREATE TABLE Event: REPL$clusterdb/simples Query OK, 0 rows affected (2.34 sec) mysql> insert into simples values (1),(2),(3),(4); Query OK, 4 rows affected (0.01 sec) Records: 4 Duplicates: 0 Warnings: 0 mysql> select * from simples; +----+ | id | +----+ | 3 | | 1 | | 2 | | 4 | +----+ 4 rows in set (0.02 sec) mysql>
我们查看下my_cluster下的文件目录
weijianzhongwj@ubuntu:~/software/mysqlc/my_cluster$ ll mysqld_data/ 总用量 28704 drwxrwxr-x 7 weijianzhongwj weijianzhongwj 4096 11月 8 21:55 ./ drwxrwxr-x 5 weijianzhongwj weijianzhongwj 4096 11月 8 15:29 ../ drwx------ 2 weijianzhongwj weijianzhongwj 4096 11月 8 21:55 clusterdb/ -rw-rw---- 1 weijianzhongwj weijianzhongwj 18874368 11月 8 17:22 ibdata1 -rw-rw---- 1 weijianzhongwj weijianzhongwj 5242880 11月 8 21:54 ib_logfile0 -rw-rw---- 1 weijianzhongwj weijianzhongwj 5242880 11月 8 15:52 ib_logfile1 drwx------ 2 weijianzhongwj weijianzhongwj 4096 11月 8 15:53 mysql/ drwx------ 2 weijianzhongwj weijianzhongwj 4096 11月 8 15:38 ndbinfo/ drwx------ 2 weijianzhongwj weijianzhongwj 4096 11月 8 15:38 performance_schema/ drwx------ 2 weijianzhongwj weijianzhongwj 4096 11月 8 15:33 test/ -rw-rw---- 1 weijianzhongwj weijianzhongwj 5 11月 8 21:54 ubuntu.pid weijianzhongwj@ubuntu:~/software/mysqlc/my_cluster$ ll ndb_data/ 总用量 72 drwxrwxr-x 4 weijianzhongwj weijianzhongwj 4096 11月 8 15:49 ./ drwxrwxr-x 5 weijianzhongwj weijianzhongwj 4096 11月 8 15:29 ../ -rw-rw-r-- 1 weijianzhongwj weijianzhongwj 14947 11月 8 21:54 ndb_1_cluster.log -rw-r--r-- 1 weijianzhongwj weijianzhongwj 76 11月 8 21:52 ndb_1_out.log -rw-r--r-- 1 weijianzhongwj weijianzhongwj 4 11月 8 21:52 ndb_1.pid drwxr-x--- 9 weijianzhongwj weijianzhongwj 4096 11月 8 15:49 ndb_3_fs/ -rw-r--r-- 1 weijianzhongwj weijianzhongwj 9961 11月 8 21:54 ndb_3_out.log -rw-r--r-- 1 weijianzhongwj weijianzhongwj 4 11月 8 21:53 ndb_3.pid drwxr-x--- 9 weijianzhongwj weijianzhongwj 4096 11月 8 15:49 ndb_4_fs/ -rw-r--r-- 1 weijianzhongwj weijianzhongwj 9783 11月 8 21:54 ndb_4_out.log -rw-r--r-- 1 weijianzhongwj weijianzhongwj 4 11月 8 21:53 ndb_4.pid
6关闭mysql server和data nodes
weijianzhongwj@ubuntu:~/software/mysqlc$ mysqladmin -u root -h 127.0.0.1 -P 5000 shutdown 121108 22:22:33 [Note] bin/mysqld: Normal shutdown 121108 22:22:33 [Note] Event Scheduler: Purging the queue. 0 events 121108 22:22:33 [Note] Stopping Cluster Utility thread weijianzhongwj@ubuntu:~/software/mysqlc$ 121108 22:22:33 [Note] Stopping Cluster Index Stats thread 121108 22:22:33 [Note] Stopping Cluster Binlog 121108 22:22:33 [Note] Stopping Cluster Index Statistics thread 121108 22:22:34 InnoDB: Starting shutdown... 121108 22:22:35 InnoDB: Shutdown completed; log sequence number 1595675 121108 22:22:35 [Note] bin/mysqld: Shutdown complete weijianzhongwj@ubuntu:~/software/mysqlc$ bin/ndb_mgm -e shutdown Connected to Management Server at: localhost:1186 3 NDB Cluster node(s) have shutdown. Disconnecting to allow management server to shutdown.
执行出下面这个错误时,需要安装下面这个包
weijianzhongwj@ubuntu:~/software/mysqlc$ sh ./scripts/mysql_install_db --no-defaults --datadir=/home/weijianzhongwj/software/mysqlc/my_cluster/mysqld_data/ Installing MySQL system tables... ./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory Installation of system tables failed! Examine the logs in /home/weijianzhongwj/software/mysqlc/my_cluster/mysqld_data/ for more information. sudo apt-get install libaio1大家可以参考http://dev.mysql.com/downloads/cluster/
发表评论
-
mysql的复制设置详解
2013-06-18 09:44 1099原文链接:http://www.javaarch.ne ... -
MySQL Events详解
2013-06-06 12:28 725原文链接:http://www.javaarch.net/ ... -
分布式唯一主键生成策略的一种开销比较小的方法
2013-06-05 09:26 1257原文链接:http://www.javaarch.net/ ... -
Oracle删除重复记录的几种方式
2013-06-05 09:26 669原文链接:http://www.javaarch.net/ ... -
Oracle 11G 虚拟列 Virtual Column介绍
2013-06-04 09:31 1207原文链接:http://www.javaarch.net/ ... -
Oracle Skip Locked
2013-06-04 09:30 809原文链接:http://www.javaarch.net/ ... -
各个数据库获取随机列的语法
2013-06-04 09:30 641原文链接:http://www.javaarch.net/ ... -
如何重置mysql的密码
2013-06-04 09:30 682原文链接:http://www.javaarch.net/ ... -
使用Mysqldump 备份数据库
2013-06-04 09:29 682原文地址:http://www.javaarch.net/ ... -
MySQL 全文搜索支持
2013-06-03 00:06 597原文地址:http://www.javaarch.net/ ... -
怎么重置mysql的自增列
2013-06-03 00:06 687原文链接:http://www.javaarch.net/ ... -
使用ssd硬盘加速 mysql index查询
2013-05-30 18:28 1475使用ssd硬盘加速 mysql index查询 更 ... -
mysql修改表默认字符集可能带来的隐患
2013-05-29 13:28 1073原文链接:http://www.javaarch.net/j ... -
Mysql 5.5分区特性增强深度解析
2013-05-22 13:49 1439原文链接:http://www.javaarc ... -
mysql常用监控脚本命令列表
2013-04-07 09:15 1265#/bin/sh #检测mysql server是否 ... -
hsqldb源码分析系列6之事务处理
2013-01-20 15:20 1673在session的 public Result ... -
hsqldb源码分析系列5 查询引擎之查询操作
2013-01-18 17:27 2263执行过程先分析select语句的解析过程: ... -
hsqldb源码分析系列4 查询引擎之查询操作
2013-01-18 00:27 985查询过程前面解析类似insert,最终调用是在 ... -
hsqldb源码分析系列3 执行引擎分析 插入过程分析
2013-01-17 21:43 1335我们看看insert语句的执行过程, 如 ... -
hsqldb源码分析系列2 解析器分析
2013-01-17 17:22 1080在server类的handleC ...
相关推荐
mysql NDB的安装配置使用示例;详细的搭建描述更适合初步了解mysql的开发人员。
2.2. 使用二进制分发版的标准MySQL安装 2.3. 在Windows上安装MySQL 2.3.1. Windows系统要求 2.3.2. 选择安装软件包 2.3.3. 用自动安装器安装MySQL 2.3.4. 使用MySQL安装向导 2.3.5. 使用配置向导 2.3.6. 通过非安装...
2.2. 使用二进制分发版的标准MySQL安装 2.3. 在Windows上安装MySQL 2.3.1. Windows系统要求 2.3.2. 选择安装软件包 2.3.3. 用自动安装器安装MySQL 2.3.4. 使用MySQL安装向导 2.3.5. 使用配置向导 2.3.6. 通过非安装...
mysql-cluster-ndb-bindings MySQL 集群的 NDB 绑定。 源代码来自 。 进行了更改以使其与 mysql cluster 7.3 一起使用。描述(取自原始项目): NDB/Bindings 是一个为 C++ NDBAPI 提供包装器的项目。 这些连接器...
2.2. 使用二进制分发版的标准MySQL安装 2.3. 在Windows上安装MySQL 2.3.1. Windows系统要求 2.3.2. 选择安装软件包 2.3.3. 用自动安装器安装MySQL 2.3.4. 使用MySQL安装向导 2.3.5. 使用配置向导 2.3.6. 通过非安装...
2.2. 使用二进制分发版的标准MySQL安装 2.3. 在Windows上安装MySQL 2.3.1. Windows系统要求 2.3.2. 选择安装软件包 2.3.3. 用自动安装器安装MySQL 2.3.4. 使用MySQL安装向导 2.3.5. 使用配置向导 2.3.6. 通过...
2.2. 使用二进制分发版的标准MySQL安装 2.3. 在Windows上安装MySQL 2.3.1. Windows系统要求 2.3.2. 选择安装软件包 2.3.3. 用自动安装器安装MySQL 2.3.4. 使用MySQL安装向导 2.3.5. 使用配置向导 2.3.6. 通过非安装...
使用二进制分发版的标准MySQL安装 2.3. 在Windows上安装MySQL 2.3.1. Windows系统要求 2.3.2. 选择安装软件包 2.3.3. 用自动安装器安装MySQL 2.3.4. 使用MySQL安装向导 2.3.5. 使用配置向导 ...
2.2. 使用二进制分发版的标准MySQL安装 2.3. 在Windows上安装MySQL 2.3.1. Windows系统要求 2.3.2. 选择安装软件包 2.3.3. 用自动安装器安装MySQL 2.3.4. 使用MySQL安装向导 2.3.5. 使用配置向导 2.3.6. 通过...
2.2. 使用二进制分发版的标准MySQL安装 2.3. 在Windows上安装MySQL 2.3.1. Windows系统要求 2.3.2. 选择安装软件包 2.3.3. 用自动安装器安装MySQL 2.3.4. 使用MySQL安装向导 2.3.5. 使用配置向导 2.3.6. 通过非安装...
2.2. 使用二进制分发版的标准MySQL安装 2.3. 在Windows上安装MySQL 2.3.1. Windows系统要求 2.3.2. 选择安装软件包 2.3.3. 用自动安装器安装MySQL 2.3.4. 使用MySQL安装向导 2.3.5. 使用配置向导 2.3.6. 通过非安装...