!!重要!! 請使用2.31.10版以後
mt是掛上實體硬碟 (mount)
umnt 移除實體硬碟(用不用都可以)
web control http://192.168.11.254:8180/
外部ssl web control https://xxx.xxx.xxx.xxx:8181/
UTF-8
重要:brige、QOS
1、更新網卡動作(因為剛灌完的網卡會比較舊,所以要更新)
mt
cd /mnt
wget http://brazilfw.com.br/users/Bender/addons/addnic/addnic.tgz
cd /
umt
reboot
etc/addnic/addnic.sh PS:實際做更新
2、抓(為了讓外網也能連到web control)
mt
cd /mnt
wget http://brazilfw.com.br/downloads/addons/sslwrap.tgz
cd /
umt
reboot
3、
澎湖人網路 外掛說明
衝突項目:
squid VS MRTG
squid VS FTP ?!
4、如果開機有問題,通常進etc改設定檔
5、IMSPECTOR
http://www.brazilfw.com.br/forum/viewtopic.php?f=2&t=68354&p=167850&hilit=imspector+wget#p167850
上Mysql HA課程 Day1 12/10 DIY
可參考
http://www.osslab.org.tw/User:Alang/%E8%8D%89%E7%A8%BF%E6%96%87%E4%BB%B6/MySQL_Cluster
http://dev.mysql.com/downloads/
MySQL Cluster
http://dev.mysql.com/downloads/select.php?id=14
MySQL Cluster Support
http://www.mysql.com/support/supportedplatforms/cluster.html
1、C:\mysql\mysql-cluster-gpl-7.0.9-win32
2、sample\my1.ini my2.ini -> C:\mysql\mysql-cluster-gpl-7.0.9-win32
3、create config.ini -> C:\mysql\mysql-cluster-gpl-7.0.9-win32
3-1、create mgmd-log -> c:\mysql
4、edit config.ini PS:大小寫沒差
Management node
[NDBD DEFAULT]
NoOfReplicas 幾台dataNode # Number of replicas
DataMemory # How much memory to allocate for data storage
IndexMemory # How much memory to allocate for index storage
[NDB_MGMD]
ID PS:只有一台時,不用打ID
DataDir 放剛建立mgmd-log目錄 # Directory for MGM node logfiles
HostName 看IP,如果在同一台就locahost PS:必需
[NDBD] 有幾個就建幾個
ID
HostName 看IP,如果在同一台就locahost PS:必需
ServerPort PS:有需要再加
DataDir PS:看你把資料放那
[MYSQLD] 要幾個就建幾個
5、start ndb_mgmd --initial -f ..\config.ini PS:先啟動 Managemnet consol
6、start ndbd --initial PS:data node #1 及 #2,分別執行兩次
訊息:Using 1 fragments
findNeighbours
不支援virtual機器,因為太多thread
??第一次執行時才需要加上 --initial,爾後啟動時,就不能在加此參數,除非是要重新作初始化
7、ndb_mgm PS:在 Management node 可以檢查 Cluster 狀態
ndb_mgm>show
PS:由於 config.ini 設定 NoOfReplicas=2,所以要啟動兩個 data-node 才會顯示狀態為 started。
ndb_mgm -e show PS:快速指令
ndb_mgm -c localhost PS:指定IP
ndb_mgm>help PS:看一些指令
8、先把data目錄copy成data1和data2
start mysqld --defaults-file=..\my1.ini
start mysqld --defaults-file=..\my2.ini
my1.ini
ndb-nodeid=21 PS:config.ini裡面的 [mysqld]設的
ndbcluster PS:使用cluster enginner
server-id=1 PS:和ndb-nodeid不同
C:\mysql\mysql-cluster-gpl-7.0.9-win32\data1\PC14.err
C:\mysql\mysql-cluster-gpl-7.0.9-win32\data2\PC14.err
C:\mysql\mgmd-log\ndb_1_cluster.txt
metadata
C:\mysql\mysql-cluster-gpl-7.0.9-win32\bin\ndb_11_fs
C:\mysql\mysql-cluster-gpl-7.0.9-win32\bin\ndb_12_fs
較重要 LCP目錄 Local check point 記憶體中的資料寫成檔案
9、[shutdown]
ndb_mgm
ndb_mgm>shutdown
單一指令:ndb_mgm -e shutdown
mysqladmin -u root shutdown
mysqladmin -u root -P 3307 shutdown
10、Boot Management node
start ndb_mgmd -f ..\config.ini
Data nodes
start ndbd
SQL nodes
start mysqld --defaults-file=..\my1.ini
start mysqld --defaults-file=..\my2.ini
當ndbd啟動會load data=>starting
11、login mysql my1 my2
my1>create database ndbtest;
my1>show database;
看my2是否有增
my2>create table ntest (id INT, name CHAR(8)) ENGINE = ndbcluster;
my1>show engines;
my1>create table mtest (id INT) ENGINE = MYISAM;
my1>show TABLES; PS:存在table mtest
my2>show TABLES; PS:不存在table mtest
my2>insert into ntest values (1,'aaa'), (2, 'bbb'), (3, 'ccc');
my1>select * from ntest;
my1>insert into ntest values (4,'ddd'), (5, 'eee');
my2>select * from ntest;
這裡看order會不一樣,因為取擇於cluster,所以都會不同,所以要注意
要用ID來排序之類,才能確定LIMIT會正確。
my2> select * from ntest LIMIT 2;
my1> select * from ntest LIMIT 2;
開工作管理員,強列關掉 ndbd.exe 1個
會產生 execTAKE_OVERTCCONF
還是可以查資料和insert
my2>insert into ntest values (4,'ddd'), (5, 'eee');
my1>select * from ntest;
start ndbd
ndbd_mgm -e show
會看到starting狀態
開工作管理員,強列關掉 舊的ndbd.exe 1個
再select看data,還是在
mysqlbinlog ..\data1\PC14-bin.000001
show VARIABLES LIKE '%bin%';
找主key會找相關datanode,找非主鍵會找每一個datanode
所以cluster的系統要重新設計
另沒有外鍵(foringkey)
Four Data Nodes
Two Node Groups
Two Replicas
匯入word.sql
改table enginer=ndbcluster
alert table xxxx enginer=ndbcluster;
??下sql查,用非主鍵join,非常慢!慢到34.23s
總之join和主鍵要非常注意
http://www.osslab.org.tw/User:Alang/%E8%8D%89%E7%A8%BF%E6%96%87%E4%BB%B6/MySQL_Cluster
http://dev.mysql.com/downloads/
MySQL Cluster
http://dev.mysql.com/downloads/select.php?id=14
MySQL Cluster Support
http://www.mysql.com/support/supportedplatforms/cluster.html
1、C:\mysql\mysql-cluster-gpl-7.0.9-win32
2、sample\my1.ini my2.ini -> C:\mysql\mysql-cluster-gpl-7.0.9-win32
3、create config.ini -> C:\mysql\mysql-cluster-gpl-7.0.9-win32
3-1、create mgmd-log -> c:\mysql
4、edit config.ini PS:大小寫沒差
Management node
[NDBD DEFAULT]
NoOfReplicas 幾台dataNode # Number of replicas
DataMemory # How much memory to allocate for data storage
IndexMemory # How much memory to allocate for index storage
[NDB_MGMD]
ID PS:只有一台時,不用打ID
DataDir 放剛建立mgmd-log目錄 # Directory for MGM node logfiles
HostName 看IP,如果在同一台就locahost PS:必需
[NDBD] 有幾個就建幾個
ID
HostName 看IP,如果在同一台就locahost PS:必需
ServerPort PS:有需要再加
DataDir PS:看你把資料放那
[MYSQLD] 要幾個就建幾個
5、start ndb_mgmd --initial -f ..\config.ini PS:先啟動 Managemnet consol
6、start ndbd --initial PS:data node #1 及 #2,分別執行兩次
訊息:Using 1 fragments
findNeighbours
不支援virtual機器,因為太多thread
??第一次執行時才需要加上 --initial,爾後啟動時,就不能在加此參數,除非是要重新作初始化
7、ndb_mgm PS:在 Management node 可以檢查 Cluster 狀態
ndb_mgm>show
PS:由於 config.ini 設定 NoOfReplicas=2,所以要啟動兩個 data-node 才會顯示狀態為 started。
ndb_mgm -e show PS:快速指令
ndb_mgm -c localhost PS:指定IP
ndb_mgm>help PS:看一些指令
8、先把data目錄copy成data1和data2
start mysqld --defaults-file=..\my1.ini
start mysqld --defaults-file=..\my2.ini
my1.ini
ndb-nodeid=21 PS:config.ini裡面的 [mysqld]設的
ndbcluster PS:使用cluster enginner
server-id=1 PS:和ndb-nodeid不同
C:\mysql\mysql-cluster-gpl-7.0.9-win32\data1\PC14.err
C:\mysql\mysql-cluster-gpl-7.0.9-win32\data2\PC14.err
C:\mysql\mgmd-log\ndb_1_cluster.txt
metadata
C:\mysql\mysql-cluster-gpl-7.0.9-win32\bin\ndb_11_fs
C:\mysql\mysql-cluster-gpl-7.0.9-win32\bin\ndb_12_fs
較重要 LCP目錄 Local check point 記憶體中的資料寫成檔案
9、[shutdown]
ndb_mgm
ndb_mgm>shutdown
單一指令:ndb_mgm -e shutdown
mysqladmin -u root shutdown
mysqladmin -u root -P 3307 shutdown
10、Boot Management node
start ndb_mgmd -f ..\config.ini
Data nodes
start ndbd
SQL nodes
start mysqld --defaults-file=..\my1.ini
start mysqld --defaults-file=..\my2.ini
當ndbd啟動會load data=>starting
11、login mysql my1 my2
my1>create database ndbtest;
my1>show database;
看my2是否有增
my2>create table ntest (id INT, name CHAR(8)) ENGINE = ndbcluster;
my1>show engines;
my1>create table mtest (id INT) ENGINE = MYISAM;
my1>show TABLES; PS:存在table mtest
my2>show TABLES; PS:不存在table mtest
my2>insert into ntest values (1,'aaa'), (2, 'bbb'), (3, 'ccc');
my1>select * from ntest;
my1>insert into ntest values (4,'ddd'), (5, 'eee');
my2>select * from ntest;
這裡看order會不一樣,因為取擇於cluster,所以都會不同,所以要注意
要用ID來排序之類,才能確定LIMIT會正確。
my2> select * from ntest LIMIT 2;
my1> select * from ntest LIMIT 2;
開工作管理員,強列關掉 ndbd.exe 1個
會產生 execTAKE_OVERTCCONF
還是可以查資料和insert
my2>insert into ntest values (4,'ddd'), (5, 'eee');
my1>select * from ntest;
start ndbd
ndbd_mgm -e show
會看到starting狀態
開工作管理員,強列關掉 舊的ndbd.exe 1個
再select看data,還是在
mysqlbinlog ..\data1\PC14-bin.000001
show VARIABLES LIKE '%bin%';
找主key會找相關datanode,找非主鍵會找每一個datanode
所以cluster的系統要重新設計
另沒有外鍵(foringkey)
Four Data Nodes
Two Node Groups
Two Replicas
匯入word.sql
改table enginer=ndbcluster
alert table xxxx enginer=ndbcluster;
??下sql查,用非主鍵join,非常慢!慢到34.23s
總之join和主鍵要非常注意
上Mysql HA課程 Day1 12/9 DIY
[Master]
Boot MySQL Server
1.server-id
2.datadir *
3.log-bin
[Slave]
Boot MySQL Server
1.server-id
2.datadir *
3.Port *
4.socket * (if in Unix like OS)
[Master]
Create user for replication slave, with password
Grant "REPLICATION SLAVE" privilege to this user
[Slave via client]
Issue 'CHANGE MASTER TO' with option:
1.MASTER HOST
2.MASTER USER
3.MASTER PASSWORD
Issue 'Start SLAVE'
============
command
[Master] PS:start可有可無
mysqld --server-id=1 --datadir=..\data1 --log-bin
start mysqld --server-id=1 --datadir=..\data1 --log-bin
[Slave]
start mysqld --server-id=2 --datadir=..\data2 --port=3307 --log-bin
[Master]
mysql -u root
[mysql root cmd]:CREATE USER 'scott'@'localhost' IDENTIFIED BY 'tiger';
mysql -u scott -p -->for login test,是否被建立? passwd:tiger
[mysql root cmd]:GRANT REPLICATION SLAVE ON *.* TO 'scott'@'localhost';
[mysql root cmd]:CREATE USER 'scott'@'xxx.xxx.xxx.xxx'; PS:允許從其他機器登陸
[mysql root cmd]:use mysql
[mysql root cmd]:SELECT User, Host, Password FROM user;
[Slave]
mysql -u root -P 3307
[mysql root cmd]:CHANGE MASTER TO MASTER_HOST='localhost', MASTER_USER='scott', MASTER_PASSWORD='tiger';
[mysql root cmd]:start slave;
[mysql root cmd]:SHOW PROCESSLIST\G;
[mysql root cmd m]:use test;
[mysql root cmd m]:show tables;
[mysql root cmd m]:create table foo (id INT, name CHAR(8));
[mysql root cmd m]:INSERT INTO foo VALUES(1,'aaa'), (2,'bbb'), (3,'ccc');
[mysql root cmd]:SHOW slave status\G;
[mysql root cmd]:SHOW master status\G;
mysqlbinlog.exe ..\datax\xxxxxxx.index PS:??
mysqlbinlog.exe ..\datax\xxxxxxx.0000xx
mysqlbinlog.exe ..\datax\xxxxxxx.info PS:??
mysql -u root -P 3307 -e "SHOW SLAVE STATUS"
mysql -u root -P 3307 -B -e "SHOW SLAVE STATUS"
mysql -u root -P 3307 -H -e "SHOW SLAVE STATUS"
mysql -u root -P 3307 -X -e "SHOW SLAVE STATUS"
mysqladmin -u root -P shutdown
mysqladmin -u root -P 3307 shutdown
[mysql root cmd m]:create table bar(id int, name char(8))
ENGINE = BLACKHCLE;
[mysql root cmd m]:insert into bar values(1, 'aaa');
[mysql root cmd s]:Alter table bar engine=MyISAM; PS:要小心
[mysql root cmd m]:create table bar2(id int, name char(8))
ENGINE = BLACKHOLE;
[mysql root cmd m]:insert into bar values(2, 'bbb');
[mysql root cmd m]:select * from bar; PS:有問題, engines被改變
[mysql root cmd m]:show engines \G;
Boot MySQL Server
1.server-id
2.datadir *
3.log-bin
[Slave]
Boot MySQL Server
1.server-id
2.datadir *
3.Port *
4.socket * (if in Unix like OS)
[Master]
Create user for replication slave, with password
Grant "REPLICATION SLAVE" privilege to this user
[Slave via client]
Issue 'CHANGE MASTER TO' with option:
1.MASTER HOST
2.MASTER USER
3.MASTER PASSWORD
Issue 'Start SLAVE'
============
command
[Master] PS:start可有可無
mysqld --server-id=1 --datadir=..\data1 --log-bin
start mysqld --server-id=1 --datadir=..\data1 --log-bin
[Slave]
start mysqld --server-id=2 --datadir=..\data2 --port=3307 --log-bin
[Master]
mysql -u root
[mysql root cmd]:CREATE USER 'scott'@'localhost' IDENTIFIED BY 'tiger';
mysql -u scott -p -->for login test,是否被建立? passwd:tiger
[mysql root cmd]:GRANT REPLICATION SLAVE ON *.* TO 'scott'@'localhost';
[mysql root cmd]:CREATE USER 'scott'@'xxx.xxx.xxx.xxx'; PS:允許從其他機器登陸
[mysql root cmd]:use mysql
[mysql root cmd]:SELECT User, Host, Password FROM user;
[Slave]
mysql -u root -P 3307
[mysql root cmd]:CHANGE MASTER TO MASTER_HOST='localhost', MASTER_USER='scott', MASTER_PASSWORD='tiger';
[mysql root cmd]:start slave;
[mysql root cmd]:SHOW PROCESSLIST\G;
[mysql root cmd m]:use test;
[mysql root cmd m]:show tables;
[mysql root cmd m]:create table foo (id INT, name CHAR(8));
[mysql root cmd m]:INSERT INTO foo VALUES(1,'aaa'), (2,'bbb'), (3,'ccc');
[mysql root cmd]:SHOW slave status\G;
[mysql root cmd]:SHOW master status\G;
mysqlbinlog.exe ..\datax\xxxxxxx.index PS:??
mysqlbinlog.exe ..\datax\xxxxxxx.0000xx
mysqlbinlog.exe ..\datax\xxxxxxx.info PS:??
mysql -u root -P 3307 -e "SHOW SLAVE STATUS"
mysql -u root -P 3307 -B -e "SHOW SLAVE STATUS"
mysql -u root -P 3307 -H -e "SHOW SLAVE STATUS"
mysql -u root -P 3307 -X -e "SHOW SLAVE STATUS"
mysqladmin -u root -P shutdown
mysqladmin -u root -P 3307 shutdown
[mysql root cmd m]:create table bar(id int, name char(8))
ENGINE = BLACKHCLE;
[mysql root cmd m]:insert into bar values(1, 'aaa');
[mysql root cmd s]:Alter table bar engine=MyISAM; PS:要小心
[mysql root cmd m]:create table bar2(id int, name char(8))
ENGINE = BLACKHOLE;
[mysql root cmd m]:insert into bar values(2, 'bbb');
[mysql root cmd m]:select * from bar; PS:有問題, engines被改變
[mysql root cmd m]:show engines \G;
上Mysql HA課程 Day1 12/9
介紹HA、cluster
用HA之前要先做評估
replcation
介紹master、slave
master->slave正常方式
master<->master 會有問題(警告)
多master->slave 不可行
當master有異動,會把bindlogs傳到slave,slave的IO 會寫到replay bindlog,之後另一個sql turning會去讀replay bindlog,把異動部份寫到data
IO和sql turning不會直接溝通,所以當master有大量資料時,IO會waiting sql turning讀bindlogs,,造成slave的資料延遲和master同步
下午 實作
combined to form Node Groups
Re-Configuration
Scale Out
NDB API
replcation過程中,不會傳資料,只會傳bindlogs
DRBD
LINBIT
MySQL Cluster ComponentsLINBIT
- Data Nodes
combined to form Node Groups
- Management Nodes
Re-Configuration
- MySQL Nodes
Scale Out
NDB API
訂閱:
文章 (Atom)