[转]KFS官方部署手册

news/2024/7/10 5:09:57 标签: python, library, file, extension, build, path

野史终归不如官方版本的,转自http://sourceforge.net/apps/trac/kosmosfs/wiki/HowToCompile

 

Required Packages¶

To compile and run KFS, you need to have the following software packages installed on your machine:

  • Boost (preferably, version 1.34 or higher)
  • cmake (preferably, version 2.4.6 or higher)
  • log4cpp (preferably, version 1.0)
  • gcc version 4.1 (or higher)
  • xfs devel RPMs on Linux

This document assumes that you have downloaded the source to directory: ~/code/kfs. We assume that you want to build the source in ~/code/kfs/build.

There are few parts to compiling the source:

  1. Build the C++ side to get the metaserver/chunkserver binaries, tools, and the C++ client library.
  2. Build the Java side to get a kfs.jar file which contains the wrapper calls to native C++ via JNI; this allows Java apps to access files stored in KFS.
  3. Building Python extension module for Python support (optional)

Building C++ Components¶

It is preferable to build KFS binaries with debugging symbols. The sequence of steps are:

cd ~/code/kfs
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo ~/code/kfs/
gmake
gmake install

The binaries will be installed in:

  1. Executables will be in: ~/code/kfs/build/bin
  2. Libraries will be in: ~/code/kfs/build/lib

Building Java Components¶

To build Java support setup:

cd ~/code/kfs
ant jar

This will produce the following set of files:

  • ~/code/kfs/build/classes --- This will contain the Java class files
  • ~/code/kfs/build/kfs-{version}.jar --- The jar file containing the Java classes

Add .jar file to your CLASSPATH environment variable

export CLASSPATH=${CLASSPATH}:~/code/kfs/build/kfs-[version].jar

Building Python Support¶

Build the KFS client library (see above). Let the path to the shared libraries is ~/code/kfs/build/lib. Now, to build the Python extension module:

cd to ~/code/kfs/src/cc/access
Edit kfs_setup.py and setup the include path. Specifically,
       kfsext = Extension('kfs', include_dirs ['kfs/src/cc/', '<path to boost>'])
python kfs_setup.py ~/code/kfs/build/lib/ build

This will build a shared object library _kfs.so_. The kfs.so library needs to be installed either in the site-packages for python or in an alternate location. To install in site-packages for python:

python kfs_setup.py ~/code/kfs/build/lib/ install

To install in alternate location such as, ~/code/kfs/build/lib

python kfs_setup.py ~/code/kfs/build/lib install --home=~/code/kfs/build/lib

If you installed in alternate location, update PYTHONPATH environment variables:

export PYTHONPATH=${PYTHONPATH}:~/code/kfs/build/lib/lib64/python

Also, update the LD_LIBRARY_PATH environment variable:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:~/code/kfs/build/lib

Using Python Client on the Mac (Leopard)¶

For the Mac, update the DYLD_LIBRARY_PATH environment variable (so that libkfsClient.dylib will be found):

export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:~/code/kfs/build/lib

  

Requirements

The KFS package comes with scripts for installing/starting/stopping KFS servers on a set of machines. The scripts use ssh to login and execute commands (either on a single node or in a cluster). The scripts require that the user have "no password" ssh access to every affected server. For every host affected, be sure you can "ssh host true" without being prompted for a password.

Defining Machine Configuration for KFS-0.2.3 (or higher)

With KFS-0.2.3. (or higher), the system configuration can be defined using two files. One that defines the enviroment (such as, paths, port numbers to etc) for all the chunkservers and another file that lists the nodes on which the chunkservers should be started. The set of machines on which KFS servers have to be deployed is defined in a configuration file that follows the Python config file format. For example, the config file machines.cfg:

[metaserver]
node: machine1
clusterkey: kfs-test-cluster
rundir: /mnt/kfs/meta
baseport: 20000
loglevel: INFO
numservers: 2
[chunkserver_defaults]
rundir: /mnt/kfs/chunk
chunkDir: /mnt/kfs/chunk/bin/kfschunk
baseport: 30000
space: 3400 G
loglevel: INFO

Next, assuming that there are 3 nodes in the cluster, their names should be listed in a separate file, machines.txt. The format of this file is one entry per line. For example,

10.2.3.1
10.2.3.2
10.2.3.3

Defining Machine Configuration (Old style format)

The set of machines on which KFS servers have to be deployed is defined in a configuration file that follows the Python config file format. For example,

[metaserver]
node: machine1
clusterkey: kfs-test-cluster
rundir: /mnt/kfs/meta
baseport: 20000
loglevel: INFO
numservers: 2
[chunkserver1]
node: machine2
rundir: /mnt/kfs/chunk
chunkDir: /mnt/kfs/chunk/bin/kfschunk
baseport: 30000
space: 3400 G
loglevel: INFO
[chunkserver2]
node: machine2
rundir: /mnt/kfs/chunk
chunkDir: /mnt/kfs/chunk/bin/kfschunk
baseport: 30000
space: 3400 G
loglevel: INFO

This file defines a configuration for a deployment comprising of a metaserver and two chunkservers. The various fields:

  • node: This defines the machine name where the binary should run
  • rundir: This defines the directory on the machine where KFS binaries will be installed.
  • baseport: This port at which the metaserver/chunkserver process will listen for connection from clients
  • loglevel: The level for outputting messages. Since KFS uses log4cpp, the values are INFO/DEBUG
  • space: The storage space exported by a chunkserver for storing chunks (units are 'G' for GigaBytes and 'M' for MegaBytes)
  • chunkDir : The list of directories used to store chunk files on the chunkserver nodes. For a JBOD configuration, this would be a space separated list of directory names.
  • clusterkey : A key that is shared between metaserver/chunkserver. On startup, each chunkserver announces itself to the metaserver and provides the cluster key. This key should match the value that the metaserver; only then is the chunkserver part of the KFS deployment.

Script for install/launching processes

Two sets of scripts are checked into the repository:

  • Linux: Use ~/code/kfs/scripts
  • Solaris, Mac OSX: Use ~/code/kfs/scripts.solaris

The instructions in this section are for Linux platform. Use the corresponding script in scripts.solaris for Solaris/Mac platforms. When you use any script which will transfer files (particularly kfssetup) on the Macintosh, you will need the additional option --tar=tar; the scripts assume that GNU tar is named "gtar" otherwise.

Installing KFS Binaries

Define the configuration in machines.cfg. Then, run the install script. The install script runs a set of processes concurrently. This works well when the servers need to be configured for a distributed setting. For a single node setup, the processes need to be launched sequentially:

  • When all the servers are on a single host
    cd ~/code/kfs/scripts
    python kfssetup.py -f machines.cfg -m machines.txt -b ../build -w ../webui -s
    
  • MacOSX:
    cd ~/code/kfs/scripts.solaris
    python kfssetup.py -f machines.cfg -m machines.txt -b ../build -w ../webui --tar=tar -s
    
  • When the servers are on multiple hosts
    cd ~/code/kfs/scripts
    python kfssetup.py -f machines.cfg -m machines.txt -b ../build -w ../webui
    

NOTE: The "-m" option is supported only with KFS-0.2.3 or higher.

Upgrading from prior KFS 0.2.x releases

Stop the servers. Upgrade the binaries and relaunch:

  • Stopping the servers:
    cd ~/code/kfs/scripts
    python kfslaunch.py -f machines.cfg -S
    
  • When all the servers are on a single host
    cd ~/code/kfs/scripts
    python kfssetup.py -f machines.cfg -b ../build -w ../webui -u -s
    
  • When the servers are on multiple hosts
    cd ~/code/kfs/scripts
    python kfssetup.py -f machines.cfg -b ../build -w ../webui -u
    

Starting KFS servers

To launch the KFS servers, run the launch script:

cd ~/code/kfs/scripts
python kfslaunch.py -f machines.cfg -m machines.txt -s

Checking System Status

To verify that the servers started up and are connected to the metaserver, use the kfsping tool:

cd ~/code/kfs/build/bin/tools
kfsping -m -s <metaserver host> -p <metaserver port>

If you using KFS-0.2.2 or higher, you can use a Web browser to monitor the servers. The KFS package now includes a simple python-based web server that shows the set of servers that are currently connected to the metaserver. The KFS web server runs on the same machine as the KFS metaserver. The web server's port is metaserver's baseport + 50. For example,

metaserver runs on machine node1 and uses port 20000
the web server runs on machine node1 at port 20050.  Point the browser at http://node1:20050

The KFS web server uses a file "all-machines.txt" to track where the chunkservers should be running. This file should be manually created and placed in ~/code/kfs/webui before deploying KFS binaries. The format of this file is the name of the chunkserver machines, one entry per line. For example.

10.2.3.1
10.2.3.2
10.2.3.3

When you open the page, http://node1:20050/cluster-view, the web server will return a web page that lists:

  1. where the chunkservers are currently running
  2. where the chunkservers could not be started (due to ssh failures, etc.)
  3. where the chunkservers have failed

Stopping KFS servers

To stop the KFS servers, run the launch script:

cd ~/code/kfs/scripts
python kfslaunch.py -f machines.cfg -m machines.txt -S

Adding new chunkservers

It is not necessary to stop the KFS servers to add new chunkservers. Simply update the machines.cfg file and start the servers (see Starting KFS servers).

Un-installing KFS Binaries

To format the filesystem/uninstall the binaries, run the install script:

cd ~/code/kfs/scripts
python kfssetup.py -f machines.cfg -m machines.txt -b ../build/bin -U

http://www.niftyadmin.cn/n/1054971.html

相关文章

自学scala的第三天——函数式编程

什么是函数式编程&#xff1f;字面意思&#xff0c;就是用函数进行编程&#xff0c;解释起来简单&#xff0c;但是实际肯定不会这么简单&#xff0c;就好比我都已经写了这么久的面向对象编程&#xff0c;你让我写函数式编程&#xff0c;这根深蒂固的面向对象一时半刻还真的无法…

Vue源码探究-状态初始化

Vue源码探究-状态初始化 Vue源码探究-源码文件组织 Vue源码探究-虚拟DOM的渲染本篇代码位于vue/src/core/instance/state.js继续随着核心类的初始化展开探索其他的模块&#xff0c;这一篇来研究一下Vue的状态初始化。这里的状态初始化指的就是在创建实例的时候&#xff0c;在配…

2019-06-08 学习日记 day29 CSS

CSS css&#xff08;Cascading Style Sheets&#xff09; CSS通常称为css样式表或层叠样式表&#xff08;级联样式表&#xff09;&#xff0c;主要用于设置THML页面中文本内容&#xff08;字体&#xff0c;大小&#xff0c;对其方式等&#xff09;&#xff0c;图片的外形&#…

跟着弦哥学人工智能2—什么是人工智能

《跟着弦哥学人工智能-序》发了之后&#xff0c;大部分群众表示喜大普奔&#xff0c;在这里对大家的支持表示感谢&#xff01; 也有个别喷子表示选的书不对&#xff0c;我觉得每个人的学习方法&#xff08;*有空可以单独写一篇关于我如何对掌握一门长技术栈学问的学习方法&…

linq 初步认识

linq to sql 类 介绍&#xff1a; linq如果不能用的话 重装一下vs就好了 LINQ&#xff0c;语言集成查询&#xff08;Language Integrated Query&#xff09;是一组用于c#和Visual Basic语言的扩展。它允许编写C#或者Visual Basic代码以查询数据库相同的方式操作内存数据。 是一…

[转]Ubuntu 10.04 LTS 安装 sun-java6-jdk

摘自论坛的一段有用的东西&#xff1a; 众所周知&#xff0c;10.04当中sun-jdk被弄走了。从某种程度上说我还是不大适应openjdk&#xff0c;于是在官方的release notes 里面看到这样一段&#xff1a;Sun Java moved to the Partner repositoryFor Ubuntu 10.04 LTS, the sun-ja…

shell 脚本启动 flask

#!/usr/bin/env bash# 第一行是说明使用的什么脚本语言&#xff0c;这里是 bash&#xff0c; 固定用法# workdir 是一个路径&#xff0c;即先切换到这个目录下&#xff0c;然后启动服务 &#xff08;启动命令&#xff1a; python app.py&#xff09;。其实不切换应该也可以 wor…

用dom4j修改xml(增加修改节点)

用dom4j修改xml&#xff08;增加修改节点&#xff09; 博客分类&#xff1a; JavaXMLJavaMyeclipseServlet 使用dom4j修改解析xml&#xff0c;xml文件的位置是配置在xml.properties文件中&#xff0c;程序打成jar包&#xff0c;在命令行中执行如下命令即可&#xff1a; [img]ht…