mysql 5.0 ¼¯Èº¸ºÔؾùºâ—¾¹ý²âÊÔ
תÔØÇë×¢Ã÷×÷Õߺͳö´¦
http://www.cnlinux.net
Ò»¡¢½éÉÜ
========
²âÊÔ»·¾³£º
Server1:ndbd 192.168.0.11
Server2:ndbd 192.168.0.12
Server3:mysqld --ndb-cluster 192.168.0.13 (ndbd_mgm ndbd_mgmdÒ²ÔÚ±¾»ú)
²Ù×÷ϵͳ¾ùΪ
RH ES3
kernel-2.4.21-9.EL
glibc-2.3.2-95.6
ËùÐèÈí¼þ°ü£º
mysql-max-5.0.22-linux-i686-icc-glibc23.tar.gz
ÏÂÔصØÖ·£ºhttp://dev.mysql.com/downloads/mysql/5.0.html
ÏÂÔØʱעÒâϵͳ»·¾³ºÍÈí¼þ°ü°æ±¾£¬MySQLÊÇmax°æµÄ¡£
Ê×ÏÈ£¬Ã÷È·¼¸¸ö¸ÅÄ²ÎÕÕÏÂͼ£©£º
ndbd£º Êý¾Ý¿â½Úµã¡£
mysqld --ndb-cluster£º MySQL·þÎñÆ÷½Úµã£¬³ÌÐòÖ±½Ó·ÃÎʵÄÊÇÕą̂»úÆ÷µÄIP¡£Ä¬È϶˿ÚÈÔÊÇ3306¡£
ndbd_mgm ndbd_mgmd£º ¹ÜÀí½Úµã¡£¹ÜÀí£¯²é¿´¸÷¿â½ÚµãºÍ·þÎñÆ÷½ÚµãµÄ״̬¡£
¶þ¡¢ÔÚServer1¡¢Server2¡¢Server3ÉÏ°²×°MySQL
=================================
1.°²×°£º
# mv mysql-max-4.1.9-pc-linux-gnu-i686.tar.gz /usr/local/
# cd /usr/local/
# tar -zxvf mysql-max-4.1.9-pc-linux-gnu-i686.tar.gz
# mv mysql-max-4.1.9-pc-linux-gnu-i686 mysql
# groupadd mysql
# useradd -g mysql mysql
# cd mysql
# scripts/mysql_install_db --user=mysql
# chown -R mysql:mysql .
2.±à¼ÅäÖÃÎļþ£º
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
# vi /etc/my.cnf ÔÚÎļþβ¼ÓÈë
# my.cnf
# example additions to my.cnf for MySQL Cluster
# (valid in MySQL 5.0)
# enable ndbcluster storage engine, and provide connectstring for
# management Server host (default port is 1186)
[mysqld]
ndbcluster
ndb-connectstring=192.168.0.13
# provide connectstring for management Server host (default port: 1186)
[ndbd]
connect-string=192.168.0.13
# provide connectstring for management Server host (default port: 1186)
[ndb_mgm]
connect-string=192.168.0.13
# provide location of cluster configuration file
[ndb_mgmd]
config-file=/var/lib/mysql-cluster
±£´æ£¦Í˳ö
3.ÔÚServer1¡¢Server2ÉÏ´´½¨ÈÕÖ¾Îļþ¼Ð£¬Ä¬ÈÏ
# mkdir /var/lib/mysql-cluster
4.ÔÚServer3ÉÏ´´½¨ndb_mgmdÆô¶¯ÅäÖÃÎļþ£º
# mkdir /var/lib/mysql-cluster
# cd /var/lib/mysql-cluster
# vi config.ini
ÄÚÈÝÈçÏ£º
# file "config.ini" - 2 data nodes and 2 SQL nodes
# T
Ïà¹ØÎĵµ£º
1¡¢È¡×Ö¶Î×¢ÊÍ
Select COLUMN_NAME ÁÐÃû, DATA_TYPE ×Ö¶ÎÀàÐÍ, COLUMN_COMMENT ×Ö¶Î×¢ÊÍ
from INFORMATION_SCHEMA.COLUMNS
Where table_name = 'companies'##±íÃû
AND table_schema = 'testhuicard'##Êý¾Ý¿âÃû
AND column_name LIKE 'c_name'##×Ö¶ÎÃû
2¡¢È¡µÃ±í×¢ÊÍ
Select table_name ±íÃû,TABLE_COMMENT ±í×¢ÊÍ ......
´æ´¢¹ý³ÌÊÇÒ»ÖÖ´æ´¢ÔÚÊý¾Ý¿âÖеijÌÐò£¨¾ÍÏñÕý¹æÓïÑÔÀïµÄ×Ó³ÌÐòÒ»Ñù£©£¬×¼È·µÄÀ´Ëµ£¬MySQLÖ§³ÖµÄ“routines£¨Àý³Ì£©”ÓÐÁ½ÖÖ£ºÒ»ÊÇÎÒÃÇ˵µÄ´æ´¢¹ý³Ì£¬ ¶þÊÇÔÚÆäËûSQLÓï¾äÖпÉÒÔ·µ»ØÖµµÄº¯Êý£¨Ê¹ÓÃÆðÀ´ºÍMysqlԤװÔصĺ¯ÊýÒ ......
ÔÚа²×°ºÃµÄmysql £¬apahce£¬php µÄʱºò£¬Èç¹ûÔÚ´úÂëÖÐʹÓÃÁËsessions_start() µÄʱºò»á³öÏÖÀàËÆÒÔϵĴíÎó£º
Warning: session_start() [function.session-start]: Cannot send session cooki µÈµÄ´íÎó¡£
Çë°²×°ÈçϵÄ˼·ȥÐÞÕý£º
1.ÔÚphp.ini ÖÐÅäÖÃ session.savepath='/tmp'
2.¿ªÆôsession.auto_start=1
3.°Ñ¸ü¸Ä ......
ÔÚUbuntuÏ°²×°µÄMySQLĬÈÏÅäÖÃϵÄÊý¾Ý¿âÎļþ´æ´¢Î»ÖÃÊÇÔÚ/var/lib/mysql£¬
MySQLÊý¾Ý¿âµÄÎļþ½á¹¹ÊÇÔõôÑùµÄÄØ£¬¶ÔÓÚÕâÑù×Ó´´½¨µÄÊý¾Ý¿âÃüÁ
¡¡¡¡CREATE¡¡DATABASE¡¡mysqldb
¡¡¡¡ÔÚĬÈϵÄÊý¾Ý¿â´æ´¢Î»ÖÃϾͻáÓиöÎļþ¼Ðmysqldb¡£Òª²Ù×÷Êý¾Ý¿âÊ×ÏȵÃÍ£Ö¹Êý¾Ý¿â½ø³Ì£º
¡¡¡¡$sudo¡¡/etc/init.d/mysql¡¡stop
±¾ÎÄÒÔת ......
ÔÚmysqlÖÐÊäÈëSHOW variables like "have_%"²é¿´£¬ÏÔʾÈçÏ£º
mysql> SHOW variables like "have_%";
+-----------------------+----------+
| Variable_name | Value |
+-----------------------+----------+
| have_archive   ......