裸机RedHat as5.3 32位机器上,裸机上默认安装有boost1.33,gcc version 4.1.2 20080704 (Red Hat 4.1.2-44),java1.4,boost和gcc(目前知道的是gcc4.1.2版本以上,boost1.33以上KFS0.5版可以编译通过)符合KFS的版本要求,只需要下载并编译使用cmake来编译KFS,下载安装git来下载xfs,KFS依赖xfs的几个头文件,java1.4升级到java1.6即可。
裸机RedHat as4.3 32位机器上,裸机上默认安装有boost1.32,gcc version 3.4.5 20051201 (Red Hat 3.4.5-2),java1.4,KFS需要依赖boost1.33以上的库,支持c++0x的新特性的gcc版本,gcc需要升级,因为KFS0.5使用了c++0x的新特性,将java1.4升级到java1.6即可。
以下是在裸机RedHat as4.3 32位机器上编译KFS的全过程:
所有依赖程序都是当前开源社区里最新的源码编译而来!
cd /data/jrckkyy/
//java最新版1.6
wget http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u22-linux-i586-rpm.bin?BundledLineItemUUID=IFaJ_hCwj6oAAAEs35YAGU.b&OrderID=TOuJ_hCw1kQAAAEs0pYAGU.b&ProductID=XUuJ_hCwWmcAAAErMVJuIQy3&FileName=/jdk-6u22-linux-i586-rpm.bin
chmod +x jdk-6u22-linux-i586-rpm.bin
./jdk-6u22-linux-i586-rpm.bin
//cmake最新版2.8.3
wget http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz
tar xvpfz cmake-2.8.3.tar.gz
cd cmake-2.8.3;./configure;make;
make install
//log4cpp最新版1.0
wget http://cdnetworks-kr-2.dl.sourceforge.net/project/log4cpp/log4cpp-1.0.x%20%28current%29/log4cpp-1.0/log4cpp-1.0.tar.gz
./configure;make;make install
//boost最新版1.44
wget http://219.239.26.18/download/7512305/8755633/3/gz/111/234/1284261323119_746/boost_1_44_0.tar.gz
tar xvpfz boost_1_44_0.tar.gz
cd boost_1_44_0
./bootstrap.sh //同目录下生成bjam可执行文件www.linuxidc.com
./bjam -a “-sTOOLS=gcc” “–includedir=/usr/include” “–libdir=/usr/lib/boost” “–build-type=complete” threading=multi “–layout=tagged” install
or
./bjam -a “-sTOOLS=gcc” stage “–build-type=complete” threading=multi “–layout=tagged” //编出库放在当前目录下的stage/lib中,方便管理
echo “/usr/lib/boost” >> /etc/ld.so.conf
export LD_LIBRARY_PATH=/usr/lib/boost
//安装最新版git1.7.3.2
wget http://kernel.org/pub/software/scm/git/git-1.7.3.2.tar.bz2
tar -jxvf git-1.7.3.2.tar.bz2;cd git-1.7.3.2;./configure;make;make install
//安装xfs,kfs需要包含xfs.h
git clone git://oss.sgi.com/xfs/cmds/xfsprogs or wget ftp://oss.sgi.com/projects/xfs/cmd_tars/xfsprogs-3.1.4.tar.gz
cd xfsprogs/
./configure;make;make install
//本机是RedHat as4.3,2005年版的gcc3.4.5升级到gcc 4.3版本以上,kfs里需要用到tr1/unordered_map.hpp
//gxx需要添加编译选项:–std=gnu++0x或者–std=c++0x 有些新版的gcc编译不需要加这个参数。www.linuxidc.com
//安装编译和使用gcc时的依赖库 其他的参考文档: http://hi.baidu.com/jrckkyy/blog/item/08d7250a16a0ba0f94ca6b86.html
wget http://www.mpfr.org/mpfr-2.4.2/mpfr-2.4.2.tar.bz2
bzip2 -d mpfr-2.4.2.tar.bz2
tar xf mpfr-2.4.2.tar;cd mpfr-2.4.2
./configure –prefix=/tools –enable-thread-safe –with-gmp=/tools
make;make install
wget http://ftp.gnu.org/gnu/gmp/gmp-5.0.1.tar.bz2
bzip2 -d gmp-5.0.1.tar.bz2
tar xvpf gmp-5.0.1.tar;cd gmp-5.0.1
./configure –prefix=/tools –enable-cxx –enable-mpbsd
make;make install
wget http://www.multiprecision.org/mpc/download/mpc-0.8.1.tar.gz
tar xvpfz mpc-0.8.1.tar.gz;cd mpc-0.8.1
./configure –with-mpfr=/tools –with-gmp=/tools –prefix=/tools
make;make install
wget ftp://ftp.dti.ad.jp/pub/lang/gcc/releases/gcc-4.5.1/gcc-4.5.1.tar.gz
tar xpvfz gcc-4.5.1.tar.gz ; cd ./gcc-4.5.1
./configure –prefix=/tools –enable-shared –enable-threads=posix –enable-__cxa_atexit –enable-clocale=gnu –enable-languages=c,c++ –disable-multilib –disable-bootstrap –with-gmp=/tools –with-mpfr=/tools –with-mpc=/tools
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tools/lib;export LD_LIBRARY_PATH; //这里必须将gmp与mpfr的库文件引入环境变量,因为绿色版的最新版g++ 4.5.1编译的时候和作为编译器使用时都需要使用到这两个依赖动态库。
make;make install
// 此时最新版本的gcc,g++就编译好了,可以看见如下效果
[root@test59 kfs-0.5]# /tools/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/tools/bin/g++
COLLECT_LTO_WRAPPER=/tools/libexec/gcc/i686-pc-linux-gnu/4.5.1/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ./configure –prefix=/tools –enable-shared –enable-threads=posix –enable-__cxa_atexit –enable-clocale=gnu –enable-languages=c,c++ –disable-multilib –disable-bootstrap –with-gmp=/tools –with-mpfr=/tools –with-mpc=/tools
Thread model: posix
gcc version 4.5.1 (GCC)
[root@test59 kfs-0.5]# g++ -v
Reading specs from /usr/lib/gcc/i386-RedHat-linux/3.4.5/specs
Configured with: ../configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –disable-checking –with-system-zlib –enable-__cxa_atexit –disable-libunwind-exceptions –enable-java-awt=gtk –host=i386-redhat-linux
Thread model: posix
gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)
//最新版kfs0.5
wget http://cdnetworks-kr-1.dl.sourceforge.net/project/kosmosfs/kosmosfs/kfs-0.5/kfs-0.5.tar.gz
tar xvpfz kfs-0.5.tar.gz
cd kfs-0.5
//在CMakeLinst.txt文件中“# get the subdirs we want”这一行注释之前加入以下变量追加和声明,boost头文件路径,boost库文件,java两个头文件目录和xfs.h头文件目录。
# added by alan 2010.11
set(Boost_INCLUDE_DIRS /data/alan/boost_1_44_0/)
set(Boost_LIBRARIES /data/alan/boost_1_44_0/stage/lib/libboost_regex-mt.a)
include_directories(/data/alan/xfsprogs/include/)
set(JAVA_INCLUDE_PATH “/usr/java/jdk1.6.0_22/include/”)
set(JAVA_INCLUDE_PATH2 “/usr/java/jdk1.6.0_22/include/linux/”)
set(CMAKE_CXX_COMPILER “/tools/bin/g++”) // 指明前面编译出来的新版本的g++所在位置,make时使用
or
//如果gcc不需要升级本来就是4.1.2以上的就加入以下cmake设置即可不用进行以上下载编译gcc依赖库及gcc了。
set(Boost_INCLUDE_DIRS /data/alan/boost_1_44_0/)
set(Boost_LIBRARIES /data/alan/boost_1_44_0/stage/lib/libboost_regex-mt.a)
include_directories(/data/alan/xfsprogs/include/)
set(JAVA_INCLUDE_PATH “/usr/java/jdk1.6.0_22/include/”)
set(JAVA_INCLUDE_PATH2 “/usr/java/jdk1.6.0_22/include/linux/”)
cmake .
make
[ 0%] Built target Version.cc
[ 0%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio.dir/qcutils.o
[ 1%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio.dir/qcfdpoll.o
[ 1%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio.dir/qciobufferpool.o
[ 2%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio.dir/qcdiskqueue.o
[ 2%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio.dir/qcthread.o
[ 3%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio.dir/qcunittest.o
[ 3%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio.dir/qcmutex.o
Linking CXX static library libqcdio.a
[ 3%] Built target qcdio
[ 4%] Building CXX object src/cc/common/CMakeFiles/kfsCommon.dir/BufferedLogWriter.o
[ 4%] Building CXX object src/cc/common/CMakeFiles/kfsCommon.dir/hsieh_hash.o
[ 5%] Building CXX object src/cc/common/CMakeFiles/kfsCommon.dir/log.o
[ 5%] Building CXX object src/cc/common/CMakeFiles/kfsCommon.dir/properties.o
[ 6%] Building CXX object src/cc/common/CMakeFiles/kfsCommon.dir/Version.o
Linking CXX static library libkfsCommon.a
[ 6%] Built target kfsCommon
[ 7%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio-shared.dir/qcutils.o
[ 7%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio-shared.dir/qcfdpoll.o
[ 8%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio-shared.dir/qciobufferpool.o
[ 8%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio-shared.dir/qcdiskqueue.o
[ 9%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio-shared.dir/qcthread.o
[ 9%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio-shared.dir/qcunittest.o
[ 10%] Building CXX object src/cc/qcdio/CMakeFiles/qcdio-shared.dir/qcmutex.o
Linking CXX shared library libqcdio.so
[ 10%] Built target qcdio-shared
[ 10%] Building CXX object src/cc/common/CMakeFiles/kfsCommon-shared.dir/BufferedLogWriter.o
[ 11%] Building CXX object src/cc/common/CMakeFiles/kfsCommon-shared.dir/hsieh_hash.o
[ 11%] Building CXX object src/cc/common/CMakeFiles/kfsCommon-shared.dir/log.o
[ 12%] Building CXX object src/cc/common/CMakeFiles/kfsCommon-shared.dir/properties.o
[ 12%] Building CXX object src/cc/common/CMakeFiles/kfsCommon-shared.dir/Version.o
Linking CXX shared library libkfsCommon.so
[ 12%] Built target kfsCommon-shared
[ 12%] Building CXX object src/cc/rebalancer/CMakeFiles/rebalancer.dir/rebalancer_main.o
Linking CXX executable rebalancer
[ 12%] Built target rebalancer
[ 12%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/checkpoint.o
[ 13%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/ChunkReplicator.o
[ 13%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/ChunkServer.o
[ 14%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/ChunkServerFactory.o
[ 14%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/ChildProcessTracker.o
[ 15%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/ClientSM.o
[ 15%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/entry.o
[ 16%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/kfsops.o
[ 16%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/kfstree.o
[ 17%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/LayoutManager.o
[ 17%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/LeaseCleaner.o
[ 18%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/logger.o
[ 18%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/meta.o
[ 19%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/NetDispatch.o
[ 19%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/replay.o
[ 20%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/request.o
[ 20%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/restore.o
[ 21%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/startup.o
[ 21%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/util.o
Linking CXX static library libkfsMeta.a
[ 21%] Built target kfsMeta
[ 21%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/Acceptor.o
[ 22%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/BufferedSocket.o
[ 22%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/Checksum.o
[ 23%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/Counter.o
[ 23%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/EventManager.o
[ 24%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/Globals.o
[ 24%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/IOBuffer.o
[ 25%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/NetConnection.o
[ 25%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/NetErrorSimulator.o
[ 26%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/NetManager.o
[ 26%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/TcpSocket.o
[ 27%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO.dir/TelemetryClient.o
Linking CXX static library libkfsIO.a
[ 27%] Built target kfsIO
[ 27%] Building CXX object src/cc/meta/CMakeFiles/filelister.dir/filelister_main.o
Linking CXX executable filelister
[ 27%] Built target filelister
[ 28%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/checkpoint.o
[ 28%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/ChunkReplicator.o
[ 29%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/ChunkServer.o
[ 29%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/ChunkServerFactory.o
[ 30%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/ChildProcessTracker.o
[ 30%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/ClientSM.o
[ 31%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/entry.o
[ 31%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/kfsops.o
[ 32%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/kfstree.o
[ 32%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/LayoutManager.o
[ 33%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/LeaseCleaner.o
[ 33%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/logger.o
[ 34%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/meta.o
[ 34%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/NetDispatch.o
[ 35%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/replay.o
[ 35%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/request.o
[ 36%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/restore.o
[ 37%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/startup.o
[ 37%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta-shared.dir/util.o
Linking CXX shared library libkfsMeta.so
[ 37%] Built target kfsMeta-shared
[ 38%] Building CXX object src/cc/meta/CMakeFiles/kfsfsck.dir/kfsfsck_main.o
Linking CXX executable kfsfsck
[ 38%] Built target kfsfsck
[ 39%] Building CXX object src/cc/meta/CMakeFiles/logcompactor.dir/logcompactor_main.o
Linking CXX executable logcompactor
[ 39%] Built target logcompactor
[ 39%] Building CXX object src/cc/meta/CMakeFiles/metaserver.dir/metaserver_main.o
Linking CXX executable metaserver
[ 39%] Built target metaserver
[ 40%] Building CXX object src/cc/chunk/CMakeFiles/chunkscrubber.dir/chunkscrubber_main.o
Linking CXX executable chunkscrubber
[ 40%] Built target chunkscrubber
[ 40%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/ChunkServer_main.o
[ 41%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/AtomicRecordAppender.o
[ 41%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/BufferManager.o
[ 42%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/ChunkManager.o
[ 42%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/ChunkServer.o
[ 43%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/ClientManager.o
[ 43%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/ClientSM.o
[ 44%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/DiskIo.o
[ 44%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/KfsOps.o
[ 45%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/LeaseClerk.o
[ 45%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/Logger.o
[ 46%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/MetaServerSM.o
[ 46%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/RemoteSyncSM.o
[ 47%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/Replicator.o
[ 47%] Building CXX object src/cc/chunk/CMakeFiles/chunkserver.dir/Utils.o
Linking CXX executable chunkserver
[ 47%] Built target chunkserver
[ 48%] Building CXX object src/cc/chunk/CMakeFiles/chunktrimmer.dir/chunktrimmer_main.o
Linking CXX executable chunktrimmer
[ 48%] Built target chunktrimmer
[ 49%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient.dir/KfsNetClient.o
[ 49%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient.dir/KfsOps.o
[ 50%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient.dir/KfsProtocolWorker.o
[ 50%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient.dir/Utils.o
[ 51%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient.dir/KfsRead.o
[ 51%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient.dir/KfsAsyncRW.o
[ 52%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient.dir/WriteAppender.o
[ 52%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient.dir/KfsWrite.o
[ 53%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient.dir/LeaseClerk.o
[ 53%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient.dir/KfsClient.o
[ 54%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient.dir/KfsPendingOp.o
Linking CXX static library libkfsClient.a
[ 54%] Built target kfsClient
[ 54%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/Acceptor.o
[ 55%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/BufferedSocket.o
[ 55%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/Checksum.o
[ 56%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/Counter.o
[ 56%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/EventManager.o
[ 57%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/Globals.o
[ 57%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/IOBuffer.o
[ 58%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/NetConnection.o
[ 58%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/NetErrorSimulator.o
[ 59%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/NetManager.o
[ 59%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/TcpSocket.o
[ 60%] Building CXX object src/cc/libkfsIO/CMakeFiles/kfsIO-shared.dir/TelemetryClient.o
Linking CXX shared library libkfsIO.so
[ 60%] Built target kfsIO-shared
[ 60%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient-shared.dir/KfsNetClient.o
[ 61%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient-shared.dir/KfsOps.o
[ 61%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient-shared.dir/KfsProtocolWorker.o
[ 62%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient-shared.dir/Utils.o
[ 62%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient-shared.dir/KfsRead.o
[ 63%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient-shared.dir/KfsAsyncRW.o
[ 63%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient-shared.dir/WriteAppender.o
[ 64%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient-shared.dir/KfsWrite.o
[ 64%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient-shared.dir/LeaseClerk.o
[ 65%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient-shared.dir/KfsClient.o
[ 65%] Building CXX object src/cc/libkfsClient/CMakeFiles/kfsClient-shared.dir/KfsPendingOp.o
Linking CXX shared library libkfsClient.so
[ 65%] Built target kfsClient-shared
[ 66%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/MonUtils.o
[ 66%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsCd.o
[ 67%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsChangeReplication.o
[ 67%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsCp.o
[ 68%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsFstat.o
[ 68%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsLs.o
[ 69%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsMkdirs.o
[ 69%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsMv.o
[ 70%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsRm.o
[ 70%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsRmdir.o
[ 71%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsPwd.o
[ 71%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsAppend.o
[ 72%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/KfsToolsCommon.o
[ 72%] Building CXX object src/cc/tools/CMakeFiles/tools.dir/utils.o
Linking CXX static library libtools.a
[ 72%] Built target tools
[ 72%] Building CXX object src/cc/tools/CMakeFiles/cpfromkfs.dir/cpfromkfs_main.o
Linking CXX executable cpfromkfs
[ 72%] Built target cpfromkfs
[ 73%] Building CXX object src/cc/tools/CMakeFiles/cptokfs.dir/cptokfs_main.o
Linking CXX executable cptokfs
[ 73%] Built target cptokfs
[ 73%] Building CXX object src/cc/tools/CMakeFiles/kfscp.dir/kfscp_main.o
Linking CXX executable kfscp
[ 73%] Built target kfscp
[ 74%] Building CXX object src/cc/tools/CMakeFiles/kfsdataverify.dir/kfsdataverify_main.o
Linking CXX executable kfsdataverify
[ 74%] Built target kfsdataverify
[ 74%] Building CXX object src/cc/tools/CMakeFiles/kfsfileenum.dir/kfsfileenum_main.o
Linking CXX executable kfsfileenum
[ 74%] Built target kfsfileenum
[ 74%] Building CXX object src/cc/tools/CMakeFiles/kfsls.dir/kfsls_main.o
Linking CXX executable kfsls
[ 74%] Built target kfsls
[ 75%] Building CXX object src/cc/tools/CMakeFiles/kfsping.dir/kfsping_main.o
Linking CXX executable kfsping
[ 75%] Built target kfsping
[ 75%] Building CXX object src/cc/tools/CMakeFiles/kfsput.dir/kfsput_main.o
Linking CXX executable kfsput
[ 75%] Built target kfsput
[ 76%] Building CXX object src/cc/tools/CMakeFiles/kfsretire.dir/kfsretire_main.o
Linking CXX executable kfsretire
[ 76%] Built target kfsretire
[ 76%] Building CXX object src/cc/tools/CMakeFiles/kfsshell.dir/kfsshell_main.o
Linking CXX executable kfsshell
[ 76%] Built target kfsshell
[ 77%] Building CXX object src/cc/tools/CMakeFiles/kfsstats.dir/kfsstats_main.o
Linking CXX executable kfsstats
[ 77%] Built target kfsstats
[ 77%] Building CXX object src/cc/tools/CMakeFiles/kfstoggleworm.dir/kfstoggleworm_main.o
Linking CXX executable kfstoggleworm
[ 77%] Built target kfstoggleworm
[ 78%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/MonUtils.o
[ 78%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsCd.o
[ 79%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsChangeReplication.o
[ 79%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsCp.o
[ 80%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsFstat.o
[ 80%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsLs.o
[ 81%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsMkdirs.o
[ 81%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsMv.o
[ 82%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsRm.o
[ 82%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsRmdir.o
[ 83%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsPwd.o
[ 83%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsAppend.o
[ 84%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/KfsToolsCommon.o
[ 85%] Building CXX object src/cc/tools/CMakeFiles/tools-shared.dir/utils.o
Linking CXX shared library libtools.so
[ 85%] Built target tools-shared
[ 85%] Building CXX object src/cc/tests/CMakeFiles/KfsDataGen.dir/KfsDataGen_main.o
Linking CXX executable KfsDataGen
[ 85%] Built target KfsDataGen
[ 86%] Building CXX object src/cc/tests/CMakeFiles/KfsDirFileTester.dir/KfsDirFileTester_main.o
Linking CXX executable KfsDirFileTester
[ 86%] Built target KfsDirFileTester
[ 86%] Building CXX object src/cc/tests/CMakeFiles/KfsDirScanTest.dir/KfsDirScanTest_main.o
Linking CXX executable KfsDirScanTest
[ 86%] Built target KfsDirScanTest
[ 87%] Building CXX object src/cc/tests/CMakeFiles/KfsLogTest.dir/KfsLogTest_main.o
Linking CXX executable KfsLogTest
[ 87%] Built target KfsLogTest
[ 87%] Building CXX object src/cc/tests/CMakeFiles/KfsPerfReader.dir/KfsPerfReader_main.o
Linking CXX executable KfsPerfReader
[ 87%] Built target KfsPerfReader
[ 88%] Building CXX object src/cc/tests/CMakeFiles/KfsPerfWriter.dir/KfsPerfWriter_main.o
Linking CXX executable KfsPerfWriter
[ 88%] Built target KfsPerfWriter
[ 88%] Building CXX object src/cc/tests/CMakeFiles/KfsRW.dir/KfsRW_main.o
Linking CXX executable KfsRW
[ 88%] Built target KfsRW
[ 89%] Building CXX object src/cc/tests/CMakeFiles/KfsReader.dir/KfsReader_main.o
Linking CXX executable KfsReader
[ 89%] Built target KfsReader
[ 89%] Building CXX object src/cc/tests/CMakeFiles/KfsRecordAppend.dir/KfsRecordAppend_main.o
Linking CXX executable KfsRecordAppend
[ 89%] Built target KfsRecordAppend
[ 90%] Building CXX object src/cc/tests/CMakeFiles/KfsSeekWrite.dir/KfsSeekWrite_main.o
Linking CXX executable KfsSeekWrite
[ 90%] Built target KfsSeekWrite
[ 90%] Building CXX object src/cc/tests/CMakeFiles/KfsTrunc.dir/KfsTrunc_main.o
Linking CXX executable KfsTrunc
[ 90%] Built target KfsTrunc
[ 91%] Building CXX object src/cc/tests/CMakeFiles/KfsWriter.dir/KfsWriter_main.o
Linking CXX executable KfsWriter
[ 91%] Built target KfsWriter
[ 92%] Building CXX object src/cc/tests/CMakeFiles/mkfstree.dir/mkfstree_main.o
Linking CXX executable mkfstree
[ 92%] Built target mkfstree
[ 93%] Building CXX object src/cc/emulator/CMakeFiles/kfsEmulator.dir/ChunkServerEmulator.o
[ 94%] Building CXX object src/cc/emulator/CMakeFiles/kfsEmulator.dir/LayoutEmulator.o
[ 94%] Building CXX object src/cc/emulator/CMakeFiles/kfsEmulator.dir/EmulatorSetup.o
Linking CXX static library libkfsEmulator.a
[ 94%] Built target kfsEmulator
[ 95%] Building CXX object src/cc/emulator/CMakeFiles/kfsEmulator-shared.dir/ChunkServerEmulator.o
[ 95%] Building CXX object src/cc/emulator/CMakeFiles/kfsEmulator-shared.dir/LayoutEmulator.o
[ 96%] Building CXX object src/cc/emulator/CMakeFiles/kfsEmulator-shared.dir/EmulatorSetup.o
Linking CXX shared library libkfsEmulator.so
[ 96%] Built target kfsEmulator-shared
[ 96%] Building CXX object src/cc/emulator/CMakeFiles/rebalanceexecutor.dir/rebalanceexecutor_main.o
Linking CXX executable rebalanceexecutor
[ 96%] Built target rebalanceexecutor
[ 97%] Building CXX object src/cc/emulator/CMakeFiles/rebalanceplanner.dir/rebalanceplanner_main.o
Linking CXX executable rebalanceplanner
[ 97%] Built target rebalanceplanner
[ 98%] Building CXX object src/cc/emulator/CMakeFiles/replicachecker.dir/replicachecker_main.o
Linking CXX executable replicachecker
[ 98%] Built target replicachecker
[ 98%] Building CXX object src/cc/emulator/CMakeFiles/rereplicator.dir/rereplicator_main.o
Linking CXX executable rereplicator
[ 98%] Built target rereplicator
[ 99%] Building CXX object src/cc/telemetry/CMakeFiles/telemetry_repeater.dir/telemetry_repeater_main.o
Linking CXX executable telemetry_repeater
[ 99%] Built target telemetry_repeater
[ 99%] Building CXX object src/cc/telemetry/CMakeFiles/telemetry_server.dir/telemetry_server_main.o
Linking CXX executable telemetry_server
[ 99%] Built target telemetry_server
[100%] Building CXX object src/cc/access/CMakeFiles/kfs_access.dir/KfsAccessJni.o
Linking CXX shared library libkfs_access.so
[100%] Built target kfs_access
现在开始编译,安装和简单的操作,我们这里采用在同一台机器上运行三个chunkserver,一个metaserver。
/data/jrckkyy/kfs0.5 为kfs解压开的目录下面开始
cd /data/jrckkyy/kfs0.5
mkdir build
cd build
// 我们先编译debug版本的
mkdir debug
cmake ../../
make install // 此时编译出来的二进制文件会自动放在 /data/jrckkyy/kfs0.5/build/debug/bin 下
// 编译release版本的
mkdir ../release;cd ../release;
cmake -D CMAKE_BUILD_TYPE=release ../../
make install // 此时编译出来的二进制文件会自动放在 /data/jrckkyy/kfs0.5/build/release/bin 下
// 编译带有调试信息的release版本
mkdir ../reldbg;cd ../reldbg
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo ../../
make install // 此时编译出来的二进制文件会自动放在 /data/jrckkyy/kfs0.5/build/reldbg/bin 下
// metaserver chunkserver 工具命令等 的二进制文件 我们现在编译好了,我们这里将三个chunkserver,一个metaserver安装在一个机器上
cd /data/jrckkyy/kfs0.5/script/
vi machines_local.cfg // 建立配置文件
# KFS Machine configuration file
#
# The following configuration is a single node KFS setup. There is
# one meta server and 2 chunk servers. The chunk servers are exporting
# 30,000,000 bytes or 30 G apiece. Note the unique values for the baseport, rundir.
#
[metaserver]
node: localhost
rundir: /data/metaserverrundir
baseport: 20000
clusterkey: test-cluster
[chunkserver1]
node: localhost
rundir: /data/chunkserver1rundir
baseport: 30000
space: 30 G
[chunkserver2]
node: localhost
rundir: /data/chunkserver2rundir
baseport: 40000
space: 30000 M
[chunkserver3]
node: localhost
rundir: /data/chunkserver3rundir
baseport: 50000
space: 30000000000
// 将metaserver chunkserver 工具程序 shell等安装到目标机器,这里采用最多25个线程并发安装25个节点,如果已经安装了,会自动忽略掉
python kfssetup.py -f machines_local.cfg -b ../build -w ../webui/ -s 0
// 启动刚才配置文件里的所有机器,如果已经启动了会自动忽略掉
python kfslaunch.py -f machines_local.cfg –start // 当然 –stop 是停止
// 用自带的ping命令 查看当前metaserver正在连接着控制的机器信息
../build/bin/tools/kfsping -m -s localhost -p 20000
Up servers: 3
s=202.106.199.36, p=40000, rack=0, used=0(GB), free=29.2969(GB), util=0%, nblocks=0, lastheard=8 (sec), ncorrupt=0, nchunksToMove=0, numDrives=1
s=202.106.199.37, p=30000, rack=0, used=0(GB), free=30(GB), util=0%, nblocks=0, lastheard=21 (sec), ncorrupt=0, nchunksToMove=0, numDrives=1
s=202.106.199.36, p=50000, rack=0, used=0(GB), free=27.9397(GB), util=0%, nblocks=0, lastheard=5 (sec), ncorrupt=0, nchunksToMove=0, numDrives=1
// 登录上 metaserver 执行shell命令 , 可以执行一些简单的shell命令,rm,rmdir,mv,stat,pwd等等,changeReplication用于改变某个文件的备份数量
python kfsshell.py -f machines_local.cfg -b ../build/release/bin/
KfsShell>
Unknown cmd:
Supported cmds are:
cd
changeReplication
cp
ls
mkdir
mv
rm
rmdir
stat
pwd
append
Type <cmd name> –help for command specific help
KfsShell>