KFS构建云存储之:KFS编译安装1
环境:Centos 6.2 x64 bit,最小安装。基础工具安装:yum install makeyum install wget1、安装KFS相关依赖包yum -y install gcc gcc-c++yum -y install log4cppyum -y install cmakeyum -y install
环境:Centos 6.2 x64 bit,最小安装。
基础工具安装:
yum install make
yum install wget
1、安装KFS相关依赖包
yum -y install gcc gcc-c++
yum -y install log4cpp
yum -y install cmake
yum -y install boost boost-devel
yum -y install ant
yum -y install openssh*
yum -y install openssl*
yum -y install fuse
yum -y python-devel
yum -y install gettext
yum -y install uuid-devel
源码安装e2xfsprogs,xfsprogs
--yum -y install xfsprogs xfsprogs-devel
--yum -y install e2fsprogs e2fsprogs-devel
源码安装e2fsprogs-1.41.12.tar.gz 目的将uuid库放到/usr/include/文件夹下
tar xzvf e2fsprogs-1.41.12.tar.gz
cd e2fsprogs-1.41.12
./configure
make
make install
cd /lib/uuid
make install
源码安装xfsprogs-3.1.2.tar.gz
tar xzvf xfsprogs-3.1.2.tar.gz
cd xfsxfsprogs-3.1.2
./configure
make
make install
makde install-dev
2、安装kfs-0.5.tar.gz
将kfs-0.5.tar.gz解压到根目录/
cd /kfs-0.5
vi CMakeLists.txt
:set nu 显示行号 在第110行:set (CMAKE_BUILD_TYPE "Debug")后面插入面内容:
SET(JAVA_INCLUDE_PATH "/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/include")
SET(JAVA_INCLUDE_PATH2 "/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/include/linux")
保存编辑CMakeLists.txt
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo /kfs-0.5/
make
make install
编译Java部分
返回一上层目录,编译生成jar包
cd ..
ant jar
如果build目录下生成了kfs-0.5.jar和classes文件夹说明成功。
安装Pathon扩展
cd /kfs-0.5/src/cc/access
vi kfs_setup.py
将:
kfsext = Extension('kfs',
include_dirs = ['/home/srao/p4trees/kfssort/kosmosfs/src/cc/',
'/usr/local/include/boost-1_37/'],
libraries = ['kfsClient'],
library_dirs = [kfs_lib_dir],
runtime_library_dirs = ['/home/qmr_ksort/sortmaster/lib'],
sources = ['KfsModulePy.cc'])
修改为:
kfsext = Extension('kfs',
include_dirs ['/kfs-0.5/src/cc/', '/usr/local/include/boost/'],
libraries = ['kfsClient'],
library_dirs = [kfs_lib_dir],
runtime_library_dirs = ['/kfs-0.5/sortmaster/lib'],
sources = ['KfsModulePy.cc'])
其中:/usr/local/include/boost/为boost的实际安装目录
保存kfs_setup.py
python kfs_setup.py /kfs-0.5/build/lib/ build
在目录/kfs-0.5/src/cc/access/build/lib.linux-x86_64-2.6/下生成了共享链接:kfs.so,表示成功
配置kfs
cd /kfs-0.5/scripts
vi machines.cfg
先拿本机做试验,本机即做metaServer也是chunkServer,整个集群只有一个node
# KFS Machine configuration file
[metaserver]
node: localhost
clusterkey:kfs-test-cluster
rundir: /kfsRun/meta
baseport: 20000
[chunkserver1]
node: localhost
rundir: /kfsRun/chunk1
baseport: 30000
space: 500 M
[chunkserver2]
node: localhost
rundir: /kfsRun/chunk2
baseport: 40000
space: 500 M
[chunkserver3]
node: localhost
rundir: /kfsRun/chunk3
baseport: 50000
space: 500 M
保存退出
修改ChunkServer.prp配置
cd /kfs-0.5/conf
vi ChunkServer.prp
# Configuration for chunk server:
# meta server location
# hostname改主机名,域名解析
chunkServer.metaServer.hostname = localhost
chunkServer.metaServer.port = 30000
# port to open for client connections
chunkServer.clientPort = 22000
# Directory for storing the chunks
chunkServer.chunkDir = ./chunks
chunkServer.logDir = ./logs
# provide 300G of storage space
# 改为3G
chunkServer.totalSpace = 3000
保存退出,进入/kfs-0.5/scripts目录,安装 metaserver 和 chunkserver:
python kfssetup.py -f machines.cfg -b ../build -w ../webui -s
更多推荐
所有评论(0)