<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[静怡家园]]></title> 
<link>http://www.zhanghaijun.com/index.php</link> 
<description><![CDATA[书山有路勤为径，学海无涯苦作舟！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[静怡家园]]></copyright>
<item>
<link>http://www.zhanghaijun.com/post/969/</link>
<title><![CDATA[CentOS下PhxSQL编译安装第二版]]></title> 
<author>碟舞飞扬 &lt;webmaster@zhanghaijun.com&gt;</author>
<category><![CDATA[开源世界]]></category>
<pubDate>Fri, 09 Sep 2016 13:40:09 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post/969/</guid> 
<description>
<![CDATA[ 
	【注】官方已经更新了依赖的第三方包的版本，最新获取的文件编译安装会遇到之前没有遇到的问题，下面是用全新最小化安装的CentOS 6.7 来编译安装的，更新系统后是CentOS 6.8了。<br/><br/>CentOS 6 全新最小化安装的操作系统：<br/><div class="code">yum install -y patch make gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel kernel-headers libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fonts-chinese gettext gettext-devel gmp-devel unzip automake libxslt libxslt-devel wget tar libcurl libcurl-devel libcap diffutils ca-certificates net-tools libc-client-devel psmisc libXpm-devel git git-core c-ares-devel libicu-devel libzip libzip-devel perl perl-devel python python-devel</div><br/><br/>#更新系统<br/>yum update<br/><br/>#相关依赖的包<br/>yum install -y readline readline-devel libstdc++-static glibc-static perl-Module-Install.noarch<br/><br/>一：获取源码：<br/>git clone --recursive https://github.com/tencent-wechat/phxsql.git （--recursive参数可以同时获得所依赖的第三方库colib,glog,leveldb,protobuf源码，和依赖库phxpaxos,phxrpc）<br/><br/>1.1：升级相关依赖的库及工具。<br/>1.1.1：autoconf<br/>下载地址：http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz<br/><div class="code">tar xzvf autoconf-2.69.tar.gz<br/>cd autoconf-2.69<br/>./configure --prefix=/usr/local/autoconf-2.69<br/>make &amp;&amp; make install<br/><br/>mv /usr/bin/autoconf /usr/bin/bak_autoconf<br/>mv /usr/bin/autoheader /usr/bin/bak_autoheader<br/>mv /usr/bin/autom4te /usr/bin/bak_autom4te<br/>mv /usr/bin/autoreconf /usr/bin/bak_autoreconf<br/>mv /usr/bin/autoscan /usr/bin/bak_autoscan<br/>mv /usr/bin/autoupdate /usr/bin/bak_autoupdate&nbsp;&nbsp; <br/>ln -sf /usr/local/autoconf-2.69/bin/autoconf /usr/bin/autoconf<br/>ln -sf /usr/local/autoconf-2.69/bin/autoheader /usr/bin/autoheader<br/>ln -sf /usr/local/autoconf-2.69/bin/autom4te /usr/bin/autom4te<br/>ln -sf /usr/local/autoconf-2.69/bin/autoreconf /usr/bin/autoreconf<br/>ln -sf /usr/local/autoconf-2.69/bin/autoscan /usr/bin/autoscan<br/>ln -sf /usr/local/autoconf-2.69/bin/autoupdate /usr/bin/autoupdate<br/></div><br/>1.1.2：automake<br/>下载地址：http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz<br/><div class="code">tar xzvf automake-1.14.tar.gz<br/>cd automake-1.14<br/>./configure --prefix=/usr/local/automake-1.14<br/>make &amp;&amp; make install<br/><br/>ln -sf /usr/local/automake-1.14/bin/aclocal-1.14 /usr/bin/aclocal-1.14<br/>ln -sf /usr/local/automake-1.14/bin/automake-1.14 /usr/bin/automake-1.14<br/>ln -sf /usr/local/automake-1.14/bin/aclocal-1.14 /usr/bin/aclocal-1.14<br/>mkdir /usr/share/automake-1.14<br/>ln -sf /usr/local/automake-1.14/share/automake-1.14/test-driver&nbsp;&nbsp;/usr/share/automake-1.14/test-driver<br/></div><br/>1.1.3：cmake<br/>下载地址：https://cmake.org/files/v3.6/cmake-3.6.1.tar.gz<br/><div class="code">tar xzvf cmake-3.6.1.tar.gz<br/>cd cmake-3.6.1<br/>./configure<br/>make &amp;&amp; make install<br/></div><br/>1.1.4：python<br/>下载地址：https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz<br/><div class="code">tar xzvf Python-2.7.12.tgz<br/>cd Python-2.7.12<br/>./configure --prefix=/usr/local/python27<br/>make &amp;&amp; make install<br/></div><br/>1.1.5：gcc<br/>下载地址：http://ftp.gnu.org/gnu/gcc/gcc-6.2.0/gcc-6.2.0.tar.gz<br/><div class="code">tar xzvf gcc-6.2.0.tar.gz<br/>cd gcc-6.2.0/<br/>./contrib/download_prerequisites<br/>cd ..<br/>mkdir gcc-build-6.2.0<br/>cd gcc-build-6.2.0/<br/>../gcc-6.2.0/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib<br/>make -j4 （-j4参数根据自己的cpu核心数来设置，这样编译的速度会快点，其实加了编译的时间也很长的）<br/>make install<br/><br/>ls /usr/local/bin &#124; grep gcc<br/>update-alternatives --install /usr/bin/gcc gcc /usr/local/bin/x86_64-pc-linux-gnu-gcc-6.2.0 40 （优先使用6.2.0版本的gcc）<br/>执行以上操作之后使用 gcc --version 就可以看见当前使用的gcc版本是gcc (GCC) 6.2.0的新版本了。<br/><br/>cp ./x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.22 /usr/lib64/<br/>删除原来低版本的软链：rm -rf /usr/lib64/libstdc++.so.6<br/>创建新版本的软链：ln -sf /usr/lib64/libstdc++.so.6.0.22 /usr/lib64/libstdc++.so.6<br/></div><br/>二、编译相关依赖<br/>2.1：colib<br/>cd /home/phxsql/third_party/colib<br/>make<br/><br/>2.2：glog<br/>cd /home/phxsql/third_party/glog<br/>./configure CXXFLAGS=-fPIC --prefix=/home/phxsql/third_party/glog<br/>make<br/>make install<br/><br/>2.3：leveldb<br/>/home/phxsql/third_party/leveldb<br/>make<br/>mkdir lib<br/>cp libleveldb.* ./lib<br/><br/>2.4：protobuf<br/>cd /home/phxsql/third_party/protobuf<br/>./autogen.sh<br/>./configure CXXFLAGS=-fPIC --prefix=/home/phxsql/third_party/protobuf<br/>make<br/>make install<br/><br/>#执行autogen.sh的时候curl报超时的问题：<br/>autogen.sh 文件的第34行gmock的下载地址是https://googlemock.googlecode.com/files/gmock-1.7.0.zip，这个地址在国内正常是访问不了的，所以在执行./autogen.sh的时候会报curl超时，翻出墙外之后这个地址也不能下载，404，应该不会是忘了上传了吧。<br/><br/>解决办法1：<br/>修改autogen.sh文件第34行的下载地址，把https://googlemock.googlecode.com/files/gmock-1.7.0.zip 改为wget http://www.zhanghaijun.com/soft/gmock-1.7.0.zip，这个我已经把两个包都下载了，打包好了。<br/><br/>解决办法2：<br/>项目地址：https://github.com/google/googlemock<br/>项目地址：https://github.com/google/googletest<br/>wget https://github.com/google/googlemock/archive/release-1.7.0.zip<br/>unzip -q release-1.7.0.zip<br/>rm release-1.7.0.zip<br/>mv googlemock-release-1.7.0 gmock<br/><br/>wget https://github.com/google/googletest/archive/release-1.7.0.zip<br/>unzip -q release-1.7.0.zip<br/>rm release-1.7.0.zip<br/>mv googletest-release-1.7.0 gmock/gtest<br/><br/>解决办法三：<br/>wget http://www.zhanghaijun.com/soft/gmock-1.7.0.zip<br/>unzip gmock-1.7.0.zip<br/>mv gmock-1.7.0 gmock<br/><br/><br/>2.5：phxrpc<br/>cd /home/phxsql/third_party/phxrpc<br/>mv third_party/protobuf third_party/bak_protobuf<br/>ln -sf /home/phxsql/third_party/protobuf /home/phxsql/third_party/phxrpc/third_party/protobuf<br/>make<br/><br/>2.6：phxpaxos<br/><div class="code">cd /home/phxsql/third_party/phxpaxos<br/>mv third_party/protobuf third_party/bak_protobuf<br/>mv third_party/leveldb third_party/bak_leveldb<br/>mv third_party/glog third_party/bak_glog<br/>ln -sf /home/phxsql/third_party/protobuf /home/phxsql/third_party/phxpaxos/third_party/protobuf<br/>ln -sf /home/phxsql/third_party/leveldb /home/phxsql/third_party/phxpaxos/third_party/leveldb<br/>ln -sf /home/phxsql/third_party/glog /home/phxsql/third_party/phxpaxos/third_party/glog<br/><br/>./autoinstall.sh<br/>make<br/>make install<br/>cd plugin<br/>make<br/>make install<br/></div><br/>三、编译安装PHXSQL<br/><div class="code">cd /home/phxsql<br/>wget https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.31-77.0/source/tarball/percona-server-5.6.31-77.0.tar.gz<br/>tar xzvf percona-server-5.6.31-77.0.tar.gz<br/>mv percona-server-5.6.31-77.0 percona<br/>sh autoinstall.sh<br/>make<br/>make install<br/></div><br/>3.1：生成安装包<br/>[root@localhost phxsql]# make package<br/>creating package phxsql-0.8.0.tar.gz...<br/><br/>生成的压缩包名称为：phxsql-0.8.0.tar.gz，把它拷贝到其他机器上就可以部署了。<br/><br/><br/>四、部署测试<br/>把安装包拷贝到其他测试的机器上，解压，本文目录为/home/phxsql<br/>创建mysql用户<br/>useradd -d /home/datacenter -s /sbin/nologin mysql<br/>mkdir /home/phxsql/etc<br/>cd /home/phxsql/tools<br/>把director_operator.py文件第26行中的chown user:mysql 修改为chown mysql:mysql<br/><br/>#因为前面测试的时候已经用三台虚拟机搭过一个集群了，这次就把这台机器加入到之前部署的集群中<br/>[root@localhost sbin]# ./phxbinlogsvr_tools_phxrpc -f AddMember -h192.168.1.241 -p17000 -m 192.168.1.243<br/>get master 192.168.1.241 expire time 1473413135<br/>AddMember 192.168.1.243 done<br/><br/>#初始化PhxSQL<br/>mkdir /home/datacenter<br/>/usr/local/python27/bin/python2.7 install.py -i&quot;192.168.1.243&quot; -p 54321 -g 6000 -y 11111 -P 17000 -a 8001 -f /home/datacenter/<br/><br/>#备份集群中其他机器的percona数据<br/>/home/phxsql/percona.src/bin/mysqldump --set-gtid-purged=off -h 192.168.1.186 -P11111 -u root --all-databases &gt;/home/all.sql<br/><br/>#kill掉新加入机器的phxbinlogsvr进程<br/>ps axf&#124;grep phxbinlogsvr&#124;grep -v grep&#124;awk &#039;&#123;print $1&#125;&#039;&#124;xargs kill<br/><br/>#通过本地端口登录新加机器的percona<br/>/home/phxsql/percona.src/bin/mysql -h 127.0.0.1 -P11111 -u root<br/><br/>#登录之后执行以下操作<br/>set GLOBAL super_read_only = 0; set GLOBAL read_only = 0;<br/><br/>#导入其他机器备份出的percona数据<br/>/home/phxsql/percona.src/bin/mysql -h 127.0.0.1 -P11111 -u root &lt; /home/all.sql<br/><br/>#启动phxbinlogsvr<br/>nohup /home/phxsql/sbin/phxbinlogsvr_phxrpc &amp;<br/><br/>之前的测试的集群由3台变成4台了<br/>[root@localhost sbin]# ./phxbinlogsvr_tools_phxrpc -f GetMemberList -h&quot;192.168.1.186&quot; -p 17000<br/>get master 192.168.1.241 expire time 1473416759<br/>ip 192.168.1.186 port 17000<br/>ip 192.168.1.180 port 17000<br/>ip 192.168.1.241 port 17000<br/>ip 192.168.1.243 port 17000<br/><br/>#查看复制状态，如果都是YES就可以测试了。<br/>/home/phxsql/percona.src/bin/mysql -h 127.0.0.1 -P11111 -u root -e &quot;show slave status&#92;G;&quot;<br/>Slave_IO_Running: Yes<br/>Slave_SQL_Running: Yes<br/><br/>#测试<br/>./test_phxsql.sh 54321 192.168.1.186 192.168.1.180 192.168.1.241 192.168.1.243<br/><a href="http://www.zhanghaijun.com/attachment.php?fid=220" target="_blank"><img src="http://www.zhanghaijun.com/attachment.php?fid=220" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>【附】：已编译版本下载：<a href="http://pan.baidu.com/s/1c1PgDQK" target="_blank">http://pan.baidu.com/s/1c1PgDQK</a> 提取密码: dhxm，MD5:ffcebea7eebf51b2b9bcd52696bd2b1f<br/>Tags - <a href="http://www.zhanghaijun.com/tags/centos/" rel="tag">centos</a> , <a href="http://www.zhanghaijun.com/tags/phxsql/" rel="tag">phxsql</a> , <a href="http://www.zhanghaijun.com/tags/percona/" rel="tag">percona</a>
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post/969/#blogcomment2495</link>
<title><![CDATA[[评论] CentOS下PhxSQL编译安装第二版]]></title> 
<author>freya &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 02 Nov 2016 07:06:38 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post/969/#blogcomment2495</guid> 
<description>
<![CDATA[ 
	get master&nbsp;&nbsp;expire time 0get master&nbsp;&nbsp;expire time 0get master&nbsp;&nbsp;expire time 0init svr fail, ret -202这是什么错误，怎么解决哈
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post/969/#blogcomment2496</link>
<title><![CDATA[[评论] CentOS下PhxSQL编译安装第二版]]></title> 
<author>freya &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 02 Nov 2016 07:08:20 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post/969/#blogcomment2496</guid> 
<description>
<![CDATA[ 
	get master&nbsp;&nbsp;expire time 0get master&nbsp;&nbsp;expire time 0get master&nbsp;&nbsp;expire time 0init svr fail, ret -202初始化过程中，增加member过程中出错，无法继续安装，怎么解决哈
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post/969/#blogcomment2497</link>
<title><![CDATA[[评论] CentOS下PhxSQL编译安装第二版]]></title> 
<author>ERIC &lt;eric_po@qq.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Dec 2016 13:06:48 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post/969/#blogcomment2497</guid> 
<description>
<![CDATA[ 
	在安装protobuf时，进行make,总是报这个错，百度，谷歌无解\n\n\n\n----------------libtool: compile:&nbsp;&nbsp;g++ -DHAVE_CONFIG_H -I. -I.. -pthread -DHAVE_PTHREAD=1 -DHAVE_ZLIB=1 -Wall -Wno-sign-compare -fPIC -MT google/protobuf/any.pb.lo -MD -MP -MF google/protobuf/.deps/any.pb.Tpo -c google/protobuf/any.pb.cc&nbsp;&nbsp;-fPIC -DPIC -o google/protobuf/.libs/any.pb.oIn file included from ./google/protobuf/any.pb.h:25,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from google/protobuf/any.pb.cc:5:./google/protobuf/metadata.h: In constructor ‘google::protobuf::internal::InternalMetadataWithArena::InternalMetadataWithArena(google::protobuf::Arena*)’:./google/protobuf/metadata.h:175: error: class ‘google::protobuf::internal::InternalMetadataWithArena’ does not have any field named ‘InternalMetadataWithArenaBase’./google/protobuf/metadata.h: In constructor ‘google::protobuf::internal::InternalMetadataWithArenaLite::InternalMetadataWithArenaLite(google::protobuf::Arena*)’:./google/protobuf/metadata.h:204: error: class ‘google::protobuf::internal::InternalMetadataWithArenaLite’ does not have any field named ‘InternalMetadataWithArenaBase’make[2]: *** [google/protobuf/any.pb.lo] Error 1make[2]: Leaving directory &#96;/opt/phxsql-master/third_party/protobuf/src\&#039;make[1]: *** [all-recursive] Error 1make[1]: Leaving directory &#96;/opt/phxsql-master/third_party/protobuf\&#039;make: *** [all] Error 2./autoinstall.sh: line 84: cd: protobuf: No such file or directoryprotobuf install fail. please check compile error info.
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post/969/#blogcomment2498</link>
<title><![CDATA[[评论] CentOS下PhxSQL编译安装第二版]]></title> 
<author>xiao &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 12 Dec 2016 03:39:57 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post/969/#blogcomment2498</guid> 
<description>
<![CDATA[ 
	libleveldb有个问题，应该是进入third_party/leveldb目录。make，编译完成后会在out-static目录生成libleveldb.a文件。mkdir lib建立一个lib目录，然后cd lib;ln -s ../out-static/libleveldb.a libleveldb.a建立一个软链，PhxSQL通过lib这个目录来寻址静态库。
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post/969/#blogcomment2503</link>
<title><![CDATA[[评论] CentOS下PhxSQL编译安装第二版]]></title> 
<author>abc92336a &lt;m18361182716@163.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 18 Mar 2017 15:09:09 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post/969/#blogcomment2503</guid> 
<description>
<![CDATA[ 
	苏州华硕电脑电子有限公司，因生产线扩大特向社会招纳电子操作工若干名，无技术要求（长期工短期工都可以，短期工必须做满1个月）<br/>招聘要求，年龄18到40岁，男女不限，初中以上学历，身体健康，无传染病，无犯罪记录，持有本人有效身份证，都可录用。工作时间，公司实行八小时工作制，八小时之外算加班，加班每小时二十元。<br/>薪资待遇：正常操作工月工资达到3800元至4500元之间，（保证不忽悠人）公司待遇，公司免费提供员工吃住，伙食很好，公司自建员工宿舍，六人一间宿舍，有独立卫生间，热水器空调，公司每月10号发工次，统一打到员工工公司地址：苏州市枫桥街道<br/>招聘热线：15851430570&nbsp;&nbsp;张经理资卡上。
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post/969/#blogcomment2504</link>
<title><![CDATA[[评论] CentOS下PhxSQL编译安装第二版]]></title> 
<author>aaa &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 30 Jun 2017 01:55:15 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post/969/#blogcomment2504</guid> 
<description>
<![CDATA[ 
	centos 6.8编译报错，如何解决[ 87%] Building C object storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/__/__/__/mysys/string.c.oLinking CXX executable pfs_connect_attr-tmake[3]: *** [storage/perfschema/unittest/pfs_connect_attr-t] Error 1make[3]: Leaving directory &#96;/data/phxsql/percona&#039;make[2]: *** [storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/all] Error 2make[2]: Leaving directory &#96;/data/phxsql/percona&#039;make[1]: *** [all] Error 2make[1]: Leaving directory &#96;/data/phxsql/percona&#039;make: *** [mysql] Error 2
]]>
</description>
</item>
</channel>
</rss>