altis 2013-11-8 04:59
在 ubuntu 12.04 上安裝 Percona Server + HandlerSocket
<p>percona-server 基本上跟 MySQL 完全相容…因為他就是從 MySQL 原始碼 Fork 出來的一個強化版的 MySQL Server ….</p>
<p>在 ubuntu 上面你還看不到他.. 所以你可以根據下面的步驟來安裝…</p><p><br></p><p>安裝步驟:</p><p># gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A</p><p># gpg -a --export CD2EFD2A | sudo apt-key add -</p><p># vim /etc/apt/sources.list (最後面加入二行)</p><p>[quote]</p><p> deb http://repo.percona.com/apt precise main</p><p> deb-src http://repo.percona.com/apt precise main</p><p>[/quote] </p><p><br></p><p># apt-get update</p><p># apt-get install percona-server-server percona-xtrabackup<br></p><p><br></p><p>到此就安裝完成, 使用方式跟 MySQL 一模一樣, "mysql -u root -p" 就可以開始使用了.</p><div><br>安裝 HandlerSocket:<br>Login to MySQL as root and run:<br><br>mysql> install plugin handlersocket soname 'handlersocket.so';<br><br>mysql> SHOW PROCESSLIST;<br>mysql> exit;<br><br>接著在 /etc/mysql/my.cnf 的 [mysqld] Section 加上底下幾行:<br>[quote]<br>performance_schema<br># server adderss<br>#bind-address = 10.0.0.2<br><br># HandlerSocket<br>loose_handlersocket_port = 9998<br># the port number to bind to for read requests<br>handlersocket_plain_secret = hsr9998<br># Authentication for the read-only listener on port 9998<br><br>loose_handlersocket_port_wr = 9999<br># the port number to bind to for write requests<br>handlersocket_plain_secret_wr = hsw9999<br># Authentication for the write listener on port 9999<br><br>loose_handlersocket_threads = 8<br># the number of worker threads for read requests<br>loose_handlersocket_threads_wr = 1<br># the number of worker threads for write requests<br>open_files_limit = 65535<br># to allow handlersocket to accept many concurrent<br># connections, make open_files_limit as large as<br># possible.<br><br># charset<br>skip-character-set-client-handshake<br>init_connect = 'SET NAMES utf8'<br>character-set-server = utf8<br>collation-server = utf8_unicode_ci<br>[/quote]<br><br>重新啟動 mysql...這樣就可以囉~~<br></div>