... | ... | @@ -8,77 +8,92 @@ |
|
|
## 1、基本环境:
|
|
|
CentOS7、libfastcommon、Berkeley、FastDHT
|
|
|
## 2、安装前需要的环境gcc
|
|
|
`yum install make cmake gcc gcc-c++`
|
|
|
## 3、正式安装
|
|
|
`cd /usr/local/src`
|
|
|
```
|
|
|
yum install make cmake gcc gcc-c++
|
|
|
cd /usr/local/src
|
|
|
``
|
|
|
### ①安装libfastcommon (安装FastDFS应该已经装了。无需重复安装)
|
|
|
`unzip libfastcommon-master.zip`
|
|
|
`cd libfastcommon-master`
|
|
|
`./make.sh && ./make.sh install`
|
|
|
|
|
|
```
|
|
|
unzip libfastcommon-master.zip
|
|
|
cd libfastcommon-master
|
|
|
./make.sh && ./make.sh install
|
|
|
```
|
|
|
### ②安装 Berkeley DB
|
|
|
`wget http://download.oracle.com/berkeley-db/db-6.2.32.tar.gz`
|
|
|
`cd /usr/local/src/db-6.0.30/ build_unix/`
|
|
|
`chmod 777 ../dist/configure`
|
|
|
`../dist/configure --prefix=/usr/local/db-6.2.32`
|
|
|
`make && make install`
|
|
|
```
|
|
|
wget http://download.oracle.com/berkeley-db/db-6.2.32.tar.gz
|
|
|
cd /usr/local/src/db-6.0.30/ build_unix/
|
|
|
chmod 777 ../dist/configure
|
|
|
../dist/configure --prefix=/usr/local/db-6.2.32
|
|
|
make && make install
|
|
|
```
|
|
|
|
|
|
### ③安装fastDHT
|
|
|
`cd /usr/local/src/`
|
|
|
`git clone https://github.com/happyfish100/fastdht.git --depth 1`
|
|
|
`cd fastdht-master `
|
|
|
`#编译之前需要先修改make.sh文件。在大约27行修改CFLAGS为:CFLAGS='-Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/usr/local/db-6.2.32/include/ -L/usr/local/db-6.2.32/lib/'`
|
|
|
`./make.sh && ./make.sh install`
|
|
|
```
|
|
|
cd /usr/local/src/
|
|
|
git clone https://github.com/happyfish100/fastdht.git --depth 1
|
|
|
cd fastdht-master
|
|
|
#编译之前需要先修改make.sh文件。在大约27行修改CFLAGS为:CFLAGS='-Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/usr/local/db-6.2.32/include/ -L/usr/local/db-6.2.32/lib/'
|
|
|
./make.sh && ./make.sh install
|
|
|
```
|
|
|
最后会在/usr/local/bin生成安装后的文件,在/etc/fdht下生成配置文件。
|
|
|
|
|
|
# 二、环境配置
|
|
|
|
|
|
## 1、创建目录
|
|
|
|
|
|
`mkdir /fastdht`
|
|
|
|
|
|
```
|
|
|
mkdir /fastdht
|
|
|
``
|
|
|
## 2、修改fdhtd.conf文件
|
|
|
`vim /etc/fdht/fdhtd.conf`
|
|
|
`port=11411`
|
|
|
`base_path=/fastdht`
|
|
|
`#include /etc/fdht/fdht_servers.conf`
|
|
|
|
|
|
```
|
|
|
vim /etc/fdht/fdhtd.conf
|
|
|
port=11411
|
|
|
base_path=/fastdht
|
|
|
#include /etc/fdht/fdht_servers.conf
|
|
|
```
|
|
|
## 3、修改fdht_servers.conf文件
|
|
|
|
|
|
`vim /etc/fdht/fdht_servers.conf`
|
|
|
`group_count = 2 #数字可自定义`
|
|
|
`group0 = 192.168.224.223:11411`
|
|
|
`group1 = 192.168.224.223:11411`
|
|
|
```
|
|
|
vim /etc/fdht/fdht_servers.conf
|
|
|
group_count = 2 #数字可自定义
|
|
|
group0 = 192.168.224.223:11411
|
|
|
group1 = 192.168.224.223:11411
|
|
|
```
|
|
|
|
|
|
## 4、修改fdht_client.conf文件
|
|
|
`vim /etc/fdht/fdht_client.conf`
|
|
|
`keep_alive=1 #本选项关联 storaged.conf文件`
|
|
|
`base_path= /fastdht `
|
|
|
`#include /etc/fdht/fdht_servers.conf #注意: #和include之间没有空格)`
|
|
|
```
|
|
|
vim /etc/fdht/fdht_client.conf
|
|
|
keep_alive=1 #本选项关联 storaged.conf文件
|
|
|
base_path= /fastdht
|
|
|
#include /etc/fdht/fdht_servers.conf #注意: #和include之间没有空格)
|
|
|
```
|
|
|
## 5、修改storage.conf文件
|
|
|
`vim /etc/fdfs/storage.conf`
|
|
|
```vim /etc/fdfs/storage.conf
|
|
|
#是否检测上传文件已经存在。如果已经存在,则不存在文件内容,建立一个索引链接以节省磁盘空间
|
|
|
`line 195: check_file_duplicate=1`
|
|
|
line 195: check_file_duplicate=1
|
|
|
# 当上个参数设定为1时 , 在FastDHT中的命名空间
|
|
|
`line 206: key_namespace=FastDFS`
|
|
|
line 206: key_namespace=FastDFS
|
|
|
#长连接配置选项,如果为0则为短连接 1为长连接
|
|
|
`line 210 keep_alive=1 `
|
|
|
line 210 keep_alive=1
|
|
|
#可以通过 #include filename 方式来加载 FastDHT servers 的配置
|
|
|
`line 217: #include /etc/fdht/fdht_servers.conf`
|
|
|
line 217: #include /etc/fdht/fdht_servers.conf
|
|
|
```
|
|
|
|
|
|
三、启动FastDHT
|
|
|
|
|
|
1、启动命令:
|
|
|
|
|
|
```
|
|
|
fdhtd /etc/fdhtd/fdhtd.conf
|
|
|
```
|
|
|
2、重启命令:
|
|
|
```
|
|
|
fdhtd /etc/fdht/fdhtd.conf restart
|
|
|
```
|
|
|
3、出错排查
|
|
|
```
|
|
|
若缺少libdb-6.0.so
|
|
|
第一步:cp /usr/local/db-6.0.30/lib/libdb-6.0.so /usr/lib/
|
|
|
第二步:查看动态链接库是否全链接完毕
|
|
|
## ldd /usr/local/bin/fdhtd
|
|
|
由图中可知缺少libdb-6.0.so
|
|
|
cp /usr/local/db-6.0.30/lib/libdb-6.0.so /usr/lib/
|
|
|
ldd /usr/local/bin/fdhtd
|
|
|
``
|
|
|
## 4、执行ldconfig命令
|
|
|
ldconfig
|
|
|
(ldconfig命令的用途, 主要是在默认搜寻目录(/lib和/usr/lib)以及动态库配置文件/etc/ld.so.conf内所列的目录下, 搜索出可共享的动态链接库(格式如lib*.so*), 进而创建出动态装入程序(ld.so)所需的连接和缓存文件. 缓存文件默认为/etc/ld.so.cache, 此文件保存已排好序的动态链接库名字列表)
|
... | ... | |