﻿{"id":1405,"date":"2016-01-13T10:44:30","date_gmt":"2016-01-13T02:44:30","guid":{"rendered":"http:\/\/nick.txtcc.com\/?p=1405"},"modified":"2016-01-14T18:18:45","modified_gmt":"2016-01-14T10:18:45","slug":"ubuntu%e4%b8%8b%e5%ae%89%e8%a3%85altas-2-2-1","status":"publish","type":"post","link":"http:\/\/nick.txtcc.com\/index.php\/linux\/1405","title":{"rendered":"Ubuntu\u4e0b\u5b89\u88c5Altas 2.2.1"},"content":{"rendered":"<h1 id=\"1-\">1. \u5b89\u88c5\u7f16\u8bd1\u53ca\u4f9d\u8d56\u73af\u5883<\/h1>\n<hr \/>\n<h2 id=\"for-mariadb\">for mariadb<\/h2>\n<pre lang=\"php\" line=\"1\" escaped=\"true\">sudo apt-get install build-essential libssl-dev liblua5.1-0-dev libmariadbd-dev flex bison gettext libjemalloc-dev libglib2.0-dev<\/pre>\n<h2 id=\"for-mysql\">for mysql<\/h2>\n<pre lang=\"php\" line=\"1\" escaped=\"true\">sudo apt-get install build-essential libssl-dev liblua5.1-dev libmysqld-dev flex bison gettext libjemalloc-dev libglib2.0-dev mysql-proxy<\/pre>\n<h1 id=\"2-\">2. \u8865\u5b8c\u5176\u4f59\u4f9d\u8d56<\/h1>\n<hr \/>\n<pre lang=\"php\" line=\"1\" escaped=\"true\">wget https:\/\/launchpad.net\/ubuntu\/+archive\/primary\/+files\/libevent_2.0.21-stable.orig.tar.gz\ntar -zxvf libevent_2.0.21-stable.orig.tar.gz\ncd libevent_2.0.21-stable\n.\/configure && make\nsudo make install\n<\/pre>\n<h1><span style=\"font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 1.5;\">3. \u9488\u5bf9configure LUA_LIBS \u53c2\u6570\u8c03\u6574\uff0c\u5efa\u7acb\u8f6f\u94fe\u63a5 \uff08<\/span>\n<strong style=\"font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 1.5;\">\u91cd\u8981<\/strong>\n<span style=\"font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 1.5;\">\uff09<\/span><\/h1>\n<hr \/>\n<pre lang=\"php\" line=\"1\" escaped=\"true\">sudo -i\nln -s \/usr\/lib\/x86_64-linux-gnu\/liblua5.1.so.0.0.0 \/usr\/local\/lib\/liblua.so.0.0.0\nln -s \/usr\/lib\/x86_64-linux-gnu\/liblua5.1-c++.a \/usr\/local\/lib\/liblua-c++.a\nln -s \/usr\/lib\/x86_64-linux-gnu\/liblua5.1-c++.so.0 \/usr\/local\/lib\/liblua-c++.so.0\nln -s \/usr\/lib\/x86_64-linux-gnu\/liblua5.1.so.0 \/usr\/local\/lib\/liblua.so.0\nln -s \/usr\/lib\/x86_64-linux-gnu\/liblua5.1-c++.so \/usr\/local\/lib\/liblua-c++.so\nln -s \/usr\/lib\/x86_64-linux-gnu\/liblua5.1-c++.so.0.0.0 \/usr\/local\/lib\/liblua-c++.so.0.0.0\nln -s \/usr\/lib\/x86_64-linux-gnu\/liblua5.1.so \/usr\/local\/lib\/liblua.so\nln -s \/usr\/lib\/x86_64-linux-gnu\/liblua5.1.a \/usr\/local\/lib\/liblua.a\nexit<\/pre>\n<h1 id=\"4-atlas-\">4. \u4e0b\u8f7dAtlas\u7a33\u5b9a\u7248\u5b89\u88c5\u5305<\/h1>\n<hr \/>\n<pre lang=\"php\" line=\"1\" escaped=\"true\">wget -O Atlas-2.2.1.zip https:\/\/codeload.github.com\/Qihoo360\/Atlas\/zip\/2.2.1\nunzip Atlas-2.2.1.zip\ncd Atlas-2.2.1\n<\/pre>\n<h1><span style=\"font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 1.5;\">5. \u4fee\u6539 bootstrap.sh LUA_CFLAGS \u5c06 \/usr\/local\/include\/ \u4fee\u6539\u4e3a \/usr\/include\/lua5.1\/ \uff08<\/span>\n<strong style=\"font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 1.5;\">\u91cd\u8981<\/strong>\n<span style=\"font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 1.5;\">\uff09<\/span><\/h1>\n<hr \/>\n<pre lang=\"php\" line=\"1\" escaped=\"true\">sudo cat > bootstrap.sh <<-\"EOF\"\n#!\/bin\/sh \nbase=$(cd \"$(dirname \"$0\")\"; pwd)\ncd $base\n# PKG_CONFIG_PATH=\/usr\/local\/lib\/pkgconfig .\/configure --with-mysql=\/usr --prefix=\/usr\/local\/mysql-proxy CFLAGS=\"-DHAVE_LUA_H -O2\" LDFLAGS=\"-lm -ldl -lcrypto -ljemalloc\" LUA_CFLAGS=\"-I\/usr\/local\/include\/\" LUA_LIBS=\"-L\/usr\/local\/lib -llua\"\nPKG_CONFIG_PATH=\/usr\/local\/lib\/pkgconfig .\/configure --with-mysql=\/usr --prefix=\/usr\/local\/mysql-proxy CFLAGS=\"-DHAVE_LUA_H -O2\" LDFLAGS=\"-lm -ldl -lcrypto -ljemalloc\" LUA_CFLAGS=\"-I\/usr\/include\/lua5.1\/\" LUA_LIBS=\"-L\/usr\/local\/lib -llua\"\n\nEOF\n<\/pre>\n<h1><span style=\"font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 1.5;\">6. \u7f16\u8bd1\u5b89\u88c5 \u6267\u884c\u8be5\u6b65\u805a\u524d\uff0c\u786e\u8ba4 \u7b2c3\u30015\u6b65\u6b63\u786e, \u5373 LUA_LIBS \u4e0e LUA_CFLAGS \u5fc5\u987b\u8bbe\u7f6e\u6b63\u786e<\/span><\/h1>\n<hr \/>\n<pre lang=\"php\" line=\"1\" escaped=\"true\">.\/bootstrap.sh\nmake\nsudo make install\n\n<\/pre>\n<h1 lang=\"php\">7.\u914d\u7f6e\u793a\u4f8b<\/h1>\n<pre lang=\"bash\" line=\"1\" escaped=\"true\">[mysql-proxy]\n\u00a0\n# (Necessary, the default value is ok) The name access to admin port\n\u00a0\nadmin-username=user\n\u00a0\n# (Necessary, the default value is ok) The password access to admin port\n\u00a0\nadmin-password=pwd\n\u00a0\n# (Necessary,set value according to the actual situation) The master database server,ip:port.\n\u00a0\nproxy-backend-addresses=192.168.88.11:3306\n\u00a0\n# (Not necessary,set value according to the actual situation) The slave database server, ip:port.\n\u00a0\n# The number behind '@'represents the weight used by load balance for reading,\n\u00a0\n# the default weight is 1. If you want the master backend also can process the read requests,\n\u00a0\n# add its ip:port to this configuration option.\n\u00a0\nproxy-read-only-backend-addresses=192.168.88.12:3306@5,192.168.88.13:3306@3,192.168.88.11:3306\n\u00a0\n# (Necessary,set value according to the actual situation) Username and its password login master and slave.\n\u00a0\n# We can use the username and password login the master database and the slave database server.\n\u00a0\n# The password encrypt by \/usr\/loca\/mysql-proxy\/bin\/encrypt.\n\u00a0\n# For example, the username is: myuser, and the password is:mypwd (encrypted ciphertext is:HJBoxfRsjeI=).\n\u00a0\npwds=repl:jNsKRuypPY0=\n\u00a0\n# (Necessary, the default value is ok) if the value is true,Atlas run as a daemon.\n\u00a0\ndaemon=false\n\u00a0\n# (Necessary, the default value is ok) Atlas will start two processes when the value set true,\n\u00a0\n# one is monitor process, another is the work process. The monitor process will restart the work process\n\u00a0\n# automatically when the work process crash unexpectedly.\n\u00a0\n# If the value set false, Atlas will only start the work process.\n\u00a0\nkeepalive=true\n\u00a0\n# (Necessary, set value according to the actual situation) The count of work threads in work process.\n\u00a0\n# set the value equal to twice of cpu cores\n\u00a0\nevent-threads=4\n\u00a0\n# (Necessary, the default value is ok) Log level: message, warning, critical, error, debug\n\u00a0\nlog-level=debug\n\u00a0\n# (Necessary, the default value is ok) Log file path\n\u00a0\nlog-path=\/usr\/local\/mysql-proxy\/log\n\u00a0\n# (Necessary, the default value is ok) The switch for printing log.\n\u00a0\n# \u00a0 \u00a0 ON\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 : log the sql to the log file with buffer.\n\u00a0\n# \u00a0 \u00a0 OFF \u00a0 \u00a0 \u00a0 \u00a0 : not log the sql.\n\u00a0\n# \u00a0 \u00a0 REALTIME\u00a0 \u00a0 : log the sql to the log file without buffer.\n\u00a0\nsql-log=REALTIME\n\u00a0\n# (Necessary, set value according to the actual situation) Slow log output settings.\n\u00a0\n# When this parameter is set, Only log the sql which execution time more than sql-log-slow (ms) logging.\n\u00a0\n# Do not set this parameter, will log all the sql.\n\u00a0\nsql-log-slow=10\n\u00a0\n# (Necessary, set value according to the actual situation) close the inactive client connections\n\u00a0\n# after \u2018wait_timeout\u2019 seconds\n\u00a0\nwait-timeout=10\n\u00a0\n# (Necessary, the default value is ok) The work port of Atlas\n\u00a0\nproxy-address=0.0.0.0:3307\n\u00a0\n# (Necessary, the default value is ok) The admin port of Atlas\n\u00a0\nadmin-address=0.0.0.0:3308\n\u00a0\n# (Not necessary, set value according to the actual situation) Shard table setting.\n\u00a0\n# In this case, person is the database name, mt is the table name, id is the shard key,\n\u00a0\n# the shard table count is 3,and you should create table mt_0, mt_1, mt_2 in mysql manually.\n\u00a0\n# If you have more shard table,you can set them and separated by commas.\n\u00a0\n#tables = person.mt.id.3\n\u00a0\n# (Not necessary,set value according to the actual situation)character set,\n\u00a0\n# If you not set this parameter, the character is latin1.\n\u00a0\ncharset=utf8\n\u00a0\n# (Not necessary,do not set this parameter) The client's IP be allowed to connect Atlas.\n\u00a0\n# If you not set this parameter, all client can connect Atlas.\n\u00a0\nclient-ips=127.0.0.1,192.168.88\n\u00a0\n# (Not necessary,do not set this parameter) If you set client-ips, and through LVS connecting Atlas,\n\u00a0\n# then you need set lvs-ips, and this parameter is the true IP of LVS.\n\u00a0\n#lvs-ips = 192.168.1.1<\/pre>","protected":false},"excerpt":{"rendered":"<ol>\n<li>\u5b89\u88c5\u7f16\u8bd1\u53ca\u4f9d\u8d56\u73af\u5883 for mariadb sudo apt-get install build-essential libssl-dev liblua5.1-0-dev libmariadbd&#46;&#46;&#46;<\/li>\n<\/ol>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[448,350],"class_list":["post-1405","post","type-post","status-publish","format-standard","hentry","category-linux","tag-altas","tag-build"],"_links":{"self":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/comments?post=1405"}],"version-history":[{"count":6,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1405\/revisions"}],"predecessor-version":[{"id":1411,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1405\/revisions\/1411"}],"wp:attachment":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/media?parent=1405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/categories?post=1405"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/tags?post=1405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}