Home > Archives > March 2008 Archive
March 2008 Archive
MySQL Cluster 5.1 CGEのSQLノードをgdbでアレしたメモ
- March 31, 2008 6:58 PM
(gdb) b ha_ndbcluster::get_ndb
色々やった後;
(gdb) bt #0 ha_ndbcluster::get_no_parts (this=0x609b628, name=0xb0496250 "./mysql/ndb_schema", no_parts=0x609ebbc) at ha_ndbcluster.cc:12437 #1 0x0000a043 in partition_default_handling (table=0xb0495934, part_info=0x609ea90, is_create_table_ind=false, normalized_path=0xb0496250 "./mysql/ndb_schema") at sql_partition.cc:199 #2 0x0000c633 in fix_partition_func (thd=0x604c818, table=0xb0495934, is_create_table_ind=false) at sql_partition.cc:1570 #3 0x0011c9b0 in open_table_from_share (thd=0x604c818, share=0xb0495fd8, alias=0x588c3c "", db_stat=0, prgflag=0, ha_open_flags=0, outparam=0xb0495934, open_mode=OTM_OPEN) at table.cc:1873 #4 0x001e00fc in ha_create_table_from_engine (thd=0x604c818, db=0x59aca0 "mysql", name=0x5cd78c "ndb_schema") at handler.cc:2730 #5 0x002bcb0d in ndb_create_table_from_engine (thd=0x604c818, db=0x59aca0 "mysql", table_name=0x5cd78c "ndb_schema") at ha_ndbcluster.cc:8522 #6 0x002d35c8 in ndbcluster_setup_binlog_table_shares (thd=0x604c818) at ha_ndbcluster_binlog.cc:869 #7 0x002c8f73 in ndb_util_thread_func (arg=0x0) at ha_ndbcluster.cc:11063 #8 0x90024227 in _pthread_body ()
ちなみに、Data Nodeは二つ、Replicaも二つ。
ndbdは、そのままではgdbをスルーして動いてしまって、ダメだ。
- Comments (Close): 0
- TrackBack (Close): 0
MySQLと文字コード
- March 27, 2008 11:06 AM
MySQL :: MySQL 5.1 Reference Manual :: 9.1.7.2 CONVERT() and CAST()
〜が~に文字化けするのは直ったか | MySQL日本語の旅 | OpenSource Web
Convert使う例
CAST()でもキャラクタセットの変換ができる | MySQL日本語の旅 | OpenSource Web
Castの紹介
メモ:
[(none)]> show variables like '%chara%'; +--------------------------+---------------------------------------------------------------+ | Variable_name | Value | +--------------------------+---------------------------------------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/local/mysql-5.1.22-rc-osx10.4-i686/share/mysql/charsets/ | +--------------------------+---------------------------------------------------------------+ 8 rows in set (0.13 sec)
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.1.22-rc-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
[(none)]> select hex(convert(_utf8"あ" using utf8));
+-------------------------------------+
| hex(convert(_utf8"あ" using utf8)) |
+-------------------------------------+
| E38182 |
+-------------------------------------+
1 row in set (0.17 sec)[(none)]> select hex(convert(_utf8"あ" using cp932));
+--------------------------------------+
| hex(convert(_utf8"あ" using cp932)) |
+--------------------------------------+
| 82A0 |
+--------------------------------------+
1 row in set (0.01 sec)[(none)]> select hex(convert(_utf8"あ" using sjis));
+-------------------------------------+
| hex(convert(_utf8"あ" using sjis)) |
+-------------------------------------+
| 82A0 |
+-------------------------------------+
1 row in set (0.10 sec)[(none)]> select hex(convert(_utf8"あ" using eucjpms));
+----------------------------------------+
| hex(convert(_utf8"あ" using eucjpms)) |
+----------------------------------------+
| A4A2 |
+----------------------------------------+
1 row in set (0.02 sec)[(none)]> select hex(convert(_utf8"あ" using ujis));
+-------------------------------------+
| hex(convert(_utf8"あ" using ujis)) |
+-------------------------------------+
| A4A2 |
+-------------------------------------+
1 row in set (0.00 sec)[(none)]> select hex(convert(_utf8"あ" using latin1));
+---------------------------------------+
| hex(convert(_utf8"あ" using latin1)) |
+---------------------------------------+
| 3F |
+---------------------------------------+
1 row in set (0.00 sec)[(none)]>
[(none)]> select convert(_utf8 0xE69C88 using utf8);
+-------------------------------------+
| convert(_utf8 0xE69C88 using utf8) |
+-------------------------------------+
| 月 |
+-------------------------------------+
1 row in set (0.00 sec)
- Comments (Close): 0
- TrackBack (Close): 0
レプリケーション対象のデータベースやテーブルを特定したい場合
- March 18, 2008 1:56 PM
マスターでの制限:バイナリログに、特定のデータベースに対する変更だけを出力させる。
bin_log_do_db=xxxxx
スレーブでの制限:リレーログのうち、特定のデータベース、特定のテーブルに対する変更だけをデータに反映させる。
replicate_do_db=xxxxx
replicate_do_table=xxxxx
- Comments (Close): 0
- TrackBack (Close): 0
権限のメモ
- March 17, 2008 3:49 PM
reload権限:
flush logs;
super権限:
show master status;
show slave status;
stop slave;
start slave;
purge master logs to;
- Comments (Close): 0
- TrackBack (Close): 0
MySQL Clusterの雑誌記事
- March 12, 2008 2:31 PM
DB Magazine 2008年 03月号でMySQL Clusterの記事が載っています。
執筆はMySQL KKマツノブ氏。
内容は、クラスタとは何か、MySQL Clusterのセットアップ、Dolphin社で実施したベンチマークの紹介など。
5.1でサポートされたMySQL Cluster Replicationや、Disk Basedのテーブルなどについては言及されていませんが、紹介記事としては良さそう。
- Comments (Close): 0
- TrackBack (Close): 0
MySQL Cluster 5.1 Carrier Grade Editionのお勧めバージョン
- March 7, 2008 11:34 AM
2008/2時点では、最新の6.3では無くて6.2がお勧め。
いくつかのtelcoで実績があるのは6.2
Johan Andersson's Blog: MySQL Cluster Features - what they are and what they do
- Comments (Close): 0
- TrackBack (Close): 0
MySQL Cluster 5.1 Carrier Grade Editionをセットアップする-2/2
- March 7, 2008 10:10 AM
MySQL Clusterの起動
まずManegementノード、Dataノードの順番で起動していく。
ちゃんとMySQL Clusterのデータディレクトリまで移動してから。
ndb@macbook$ sudo /usr/local/mysql-5.1-telco/bin/ndb_mgmdndb@macbook$ sudo /usr/local/mysql-5.1-telco/bin/ndbd
Instance ManagerからMySQL Serverを起動して、NDBエンジンがオンになっていること、ENGINE=NDBのテーブルが作成できて、データを挿入できることを確認する。
- Comments (Close): 0
- TrackBack (Close): 0
MySQL Cluster 5.1 Carrier Grade Editionをセットアップする-1/2
- March 6, 2008 7:03 PM
ソースファイルの準備
BitKeeperツリーからダウンロード
/usr/local/bk-client2.0/bkf clone bk://mysql.bkbits.net/mysql-5.1-telco mysql-5.1-telco
ビルドの準備
詳解 MySQLを手順を参考に。
1. BUID/compile-pentium-debugをコピーしてBUID/compile-hirohamaへ2. compile-hirohamaを開く
3. extra_flags="-g $debug_cflags"
4. extra_configs=.の行を削除
5. extra_configs=""を. "$path/FINISH.sh"の前に追加
6. 保存
すると、こんな感じになる。
BUILD@macbook$ cat compile-hirohama #! /bin/shpath=`dirname $0`
set -- "$@" --with-debug=full
. "$path/SETUP.sh"extra_flags="-g $debug_cflags"
extra_configs=""
. "$path/FINISH.sh"
ここで、さらにextra_configsを修正する。
extra_configs="$pentium_configs $debug_configs $max_configs $error_inject --with-experimental-collations prefix=/usr/local/mysql-5.1-telco --localstatedir=/Users/hirohama/data/data10 --libexecdir=/usr/local/mysql-5.1-telco/bin --with-comment='MySQL Cluster CGE' --enable-thread-safe-client --enable-local-infile --with-pic --with-client-ldflags=-static --with-mysqld-ldflags=-static --with-zlib-dir=bundled --with-big-tables --with-ssl --with-readline --with-embedded-server --with-archive-storage-engine --with-blackhole-storage-engine --with-ndbcluster --with-csv-storage-engine --with-example-storage-engine --with-federated-storage-engine --with-partition --with-innodb --with-extra-charsets=all"
BUILD/compile-hirohamaを実行。20〜30分ほど待つ。
インストール
sudo make testとか、sudo make installで、再度ちょっと待つ。
mysql_install_dbはbinディレクトリに展開されているでの、これを使って権限テーブルをセットアップする。
ちなみに、make installの代わりに、ここで./scripts/make_binary_distributionスクリプトを実行すると、(mysql.comで配布されているように)tar.gzで固めてソース直下に配置してくれるらしい。
また、make_binary_distribution実行時は、--no-stripオプションつきがお勧めらしい。
設定
/etc/my.cnfにInstance Manager用の項目を追加する
[mysqld10] nonguarded socket=/tmp/mysql10.sock pid-file=/tmp/mysql10.pid datadir=/Users/hirohama/data/data10 basedir=/usr/local/mysql-5.1-telco mysqld-path=/usr/local/mysql-5.1-telco/bin/mysqld expire_logs_days=5port=3315
server-id=20
log-bin=/Users/hirohama/data/data10/10
log=/Users/hirohama/data/data10/10.log
MySQL Instance Managerで起動した後で、MySQLクライアントでアクセスできることを確認する。
MySQL Clusterのセットアップ
/etc/my.cnfの該当セクションに以下を追加する。
ndbcluster
log-bin
binlog-format=row[mysql_cluster]
ndb-connectstring=localhost[ndb_mgmd]
config-file=/Users/hirohama/data/ndb/config.ini
/Users/hirohama/data/ndb/config.iniを作成
[NDBD DEFAULT] NoOfReplicas= 1 DataDir= /Users/hirohama/data/ndb[NDB_MGMD]
Hostname= localhost[NDBD]
HostName= localhost[MYSQLD]
[MYSQLD]
- Comments (Close): 0
- TrackBack (Close): 0