注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Bioinformatics home

 
 
 

日志

 
 

mysql集群 二  

2012-02-13 23:42:14|  分类: mysql |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
C: 启动mysqld服务。BSD爱好者乐园!c:d4U$i'}
BSD爱好者乐园%Z-m#` h&z R ? p P
BSD爱好者乐园"S u(W ^ O v
打开mysql-5.0.45-linux-i686下的configure文件,可以看到其内容为:"v {#j K E @&t1w
  • #!/bin/sh
  • if test ! -x ./scripts/mysql_install_db
  • then
  • echo "I didn't find the script './scripts/mysql_install_db'."
  • echo "Please execute this script in the mysql distribution directory!"
  • exit 1;
  • fi
  • echo "NOTE: This is a MySQL binary distribution. It's ready to run, you don't"
  • echo "need to configure it!"
  • echo ""
  • echo "To help you a bit, I am now going to create the needed MySQL databases"
  • echo "and start the MySQL server for you. If you run into any trouble, please"
  • echo "consult the MySQL manual, that you can find in the Docs directory."
  • echo ""
  • ./scripts/mysql_install_db --no-defaults
  • if [ $? = 0 ]
  • then
  • echo "Starting the mysqld server. You can test that it is up and running"
  • echo "with the command:"
  • echo "./bin/mysqladmin version"
  • ./bin/mysqld_safe --no-defaults & #默认会去根据/etc/my.cnf这个配置文件进行启动,并且生成的sock端口会放在/tmp/mysql.sock
  • fi
  • #!/bin/sh if test ! -x ./scripts/mysql_install_db then echo "I didn't find the script './scripts/mysql_install_db'." echo "Please execute this script in the mysql distribution directory!" exit 1; fi echo "NOTE: This is a MySQL binary distribution. It's ready to run, you don't" echo "need to configure it!" echo "" echo "To help you a bit, I am now going to create the needed MySQL databases" echo "and start the MySQL server for you. If you run into any trouble, please" echo "consult the MySQL manual, that you can find in the Docs directory." echo "" ./scripts/mysql_install_db --no-defaults if [ $? = 0 ] then echo "Starting the mysqld server. You can test that it is up and running" echo "with the command:" echo "./bin/mysqladmin version" ./bin/mysqld_safe --no-defaults & #默认会去根据/etc/my.cnf这个配置文件进行启动,并且生成的sock端口会放在/tmp/mysql.sock fiBSD爱好者乐园&H3@9b J j'T6L3y:t

    可 以看到:它实际是上先执行./scripts/mysql_install_db,然后在去通过./bin/mysqld_safe去启动mysql服务 的,用的参数是--no-defaults,也就是默认会去根据/etc/my.cnf这个配置文件进行启动,并且生成的sock端口会放在/tmp /mysql.sock.BSD爱好者乐园3t-n y y A X-z&M%V
    BSD爱好者乐园 f/u | Q z
    如果想让mysql启动时调用自己指定的my.cnf的位置。可以把configure文件内容里的./bin/mysqld_safe --no-defaults &修改为:BSD爱好者乐园 p K l I;_ \ ?

  • ./bin/mysqld_safe --defaults-file=my3.cnf & #当前目录下的my.cnf,也可以自己指定绝对路径
  • ./bin/mysqld_safe --defaults-file=my3.cnf & #当前目录下的my.cnf,也可以自己指定绝对路径

    O1w H d$g9N:F.gBSD爱好者乐园.{!f v6~ k h i0E T
    建立my3.cnf和数据目录data3
    r B4J&] P7x
    |5q h9p4k2K/o `编辑my3.cnf:

    I h s T1L&q
  • [mysqld]
  • port = 3306
  • socket = /home/mahaibo/mysql-5.0.45-linux-i686/mysql3.sock
  • datadir = /home/mahaibo/mysql-5.0.45-linux-i686/data3
  • ndbcluster # run NDB engine
  • ndb-connectstring=127.0.0.1:2203 # location of MGM node
  • skip-locking
  • key_buffer = 16M
  • max_allowed_packet = 1M
  • table_cache = 64
  • sort_buffer_size = 512K
  • net_buffer_length = 8K
  • read_buffer_size = 256K
  • read_rnd_buffer_size = 512K
  • myisam_sort_buffer_size = 8M
  • [mysqld] port = 3306 socket = /home/mahaibo/mysql-5.0.45-linux-i686/mysql3.sock datadir = /home/mahaibo/mysql-5.0.45-linux-i686/data3 ndbcluster # run NDB engine ndb-connectstring=127.0.0.1:2203 # location of MGM node skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8MBSD爱好者乐园!i4g h q!p)c @ m9J

    启动mysqld服务:

    W \ Z&[9o }3p z+k"b1f
  • ./configure3
  • ./configure3BSD爱好者乐园 q i h:G U

    BSD爱好者乐园/a3Z#Q L u-b x,W&f8y-f6H V5c;y d如果这时在登录到mgmd管理节点的客户端mgm,

    b!{'c { M s _ K C/v f
  • [mahaibo@client mysql-5.0.45-linux-i686]$ bin/ndb_mgm 127.0.0.1 2203
  • -- NDB Cluster -- Management Client --
  • ndb_mgm> show
  • Connected to Management Server at: 127.0.0.1:2203
  • Cluster Configuration
  • ---------------------
  • [ndbd(NDB)]2 node(s)
  • id=2@127.0.0.1 (Version: 5.0.45, Nodegroup: 0, Master)
  • id=3@127.0.0.1 (Version: 5.0.45, Nodegroup: 1)
  • [ndb_mgmd(MGM)] 1 node(s)
  • id=1@127.0.0.1 (Version: 5.0.45)
  • [mysqld(API)]1 node(s)
  • id=4@127.0.0.1 (Version: 5.0.45)
  • [mahaibo@client mysql-5.0.45-linux-i686]$ bin/ndb_mgm 127.0.0.1 2203 -- NDB Cluster -- Management Client -- ndb_mgm> show Connected to Management Server at: 127.0.0.1:2203 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=2 @127.0.0.1 (Version: 5.0.45, Nodegroup: 0, Master) id=3 @127.0.0.1 (Version: 5.0.45, Nodegroup: 1) [ndb_mgmd(MGM)] 1 node(s) id=1 @127.0.0.1 (Version: 5.0.45) [mysqld(API)] 1 node(s) id=4 @127.0.0.1 (Version: 5.0.45)BSD爱好者乐园0F0W `8S#|,I1y)o,@+Z Z ?

    j+o a;i z%c"i z可以看到mysqld也是连接状态了
    1l!X Z0q G6T ~&f
    X S t(F(z R x-^)d登录到mysqld的客户端,然后BSD爱好者乐园 l b#Z I.P8k N ? [

  • show variables like 'have%';
  • show variables like 'have%';

    U W L.h J L m3u D ?
    U e P(y i1w,@ J w8?可以看到
    %N5z)d6M y$b.whave_ndbcluster 为 YES,说明ndbcluster引擎已经打开。BSD爱好者乐园 ?-c'W,w+h [ G R1M7] z G.^ I [ e d z'G可以建立一个ndbcluster引擎的表测试下看是否成功BSD爱好者乐园7}'Y%Y5g t H N-\ _ b U/O'a

  • create table table1 (aa int) engine=ndbcluster;
  • insert into table1 values(11);
  • insert into table1 values(22);
  • create table table1 (aa int) engine=ndbcluster; insert into table1 values(11); insert into table1 values(22);BSD爱好者乐园/v j8Z n J E P

    都没有问题。BSD爱好者乐园8i0Q l M.M c {
    show create table table1;
    (e R"d;y%U7o可以看到:

    "W e ^ h a,s S
  • mysql> show create table table1;
  • +--------+------------------------------------------------------------------------------------------------+
  • | Table | Create Table |
  • +--------+------------------------------------------------------------------------------------------------+
  • | table1 | CREATE TABLE `table1` (
  • `aa` int(11) default NULL
  • ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 |
  • +--------+------------------------------------------------------------------------------------------------+
  • 1 row in set (0.00 sec)
  • mysql> show create table table1; +--------+------------------------------------------------------------------------------------------------+ | Table | Create Table | +--------+------------------------------------------------------------------------------------------------+ | table1 | CREATE TABLE `table1` ( `aa` int(11) default NULL ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 | +--------+------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)k4n6F _ g#d5g以上只是记录的配置流水账过程,也许有些说的不对的地方,请多指点。具体项目应用还需要具体参考mysql文档进行配置
      评论这张
     
    阅读(667)| 评论(0)
    推荐 转载

    历史上的今天

    在LOFTER的更多文章

    评论

    <#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    页脚

    网易公司版权所有 ©1997-2017