标签:fastdfs
1.基础环境
IP | 操作系统 |
192.168.56.121(edu-dfs-tracker-01) | CentOS Linux release 7.3.1611 (Core) |
192.168.56.125(edu-dfs-storage-01) | CentOS Linux release 7.3.1611 (Core) |
2.防火墙关闭 selinux关闭
3.主机名解析
[root@edu-dfs-tracker-01 src]# cat /etc/hosts 192.168.56.121 edu-dfs-tracker-01 192.168.56.125 edu-dfs-storage-01
4.上传所需要的安装包 看主机名哪台服务器
tracker:
[root@edu-dfs-tracker-01 src]# ll total 504 -rw-r--r-- 1 root root 336001 Jan 1 10:17 fastdfs-5.05.tar.gz -rw-r--r-- 1 root root 171755 Jan 1 10:21 libfastcommon-master.zip [root@edu-dfs-tracker-01 src]#
storage:
[root@edu-dfs-storage-01 src]# ll total 1312 -rw-r--r-- 1 root root 336001 Jan 1 10:17 fastdfs-5.05.tar.gz -rw-r--r-- 1 root root 17510 Jan 1 10:03 fastdfs-nginx-module_v1.16.tar.gz -rw-r--r-- 1 root root 171755 Jan 1 10:21 libfastcommon-master.zip -rw-r--r-- 1 root root 804164 Jan 1 10:08 nginx-1.6.2.tar.gz [root@edu-dfs-storage-01 src]#
5.基础环境安装 不安装后面报错
yum -y install perl perl-devel make gcc-c++ gcc cmake
6.安装公共的common库
两台服务器都得安装座一样的操作
cd /usr/local/src unzip libfastcommon-master.zip cd libfastcommon-master ./make.sh ./make.sh install ##### [root@edu-dfs-tracker-01 libfastcommon-master]# ./make.sh install mkdir -p /usr/lib64 mkdir -p /usr/lib install -m 755 libfastcommon.so /usr/lib64 install -m 755 libfastcommon.so /usr/lib mkdir -p /usr/include/fastcommon install -m 644 common_define.h hash.h chain.h logger.h base64.h shared_func.h pthread_func.h ini_file_reader.h _os_define.h sockopt.h sched_thread.h http_func.h md5.h local_ip_func.h avl_tree.h ioevent.h ioevent_loop.h fast_task_queue.h fast_timer.h process_ctrl.h fast_mblock.h connection_pool.h fast_mpool.h fast_allocator.h fast_buffer.h skiplist.h multi_skiplist.h flat_skiplist.h skiplist_common.h system_info.h fast_blocked_queue.h php7_ext_wrapper.h id_generator.h char_converter.h char_convert_loader.h /usr/include/fastcommon [root@edu-dfs-tracker-01 libfastcommon-master]#
7.做软连接:fastdfs主程序设置的lib路径是/usr/local/lib 单默认并不是所以软连接
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so
8.安装fastdfs
两台都需要安装
cd /usr/local/src tar xf fastdfs-5.05.tar.gz cd fastdfs-5.05 ./make.sh ./make.sh install
9.fastdfs安装后文件说明
9.1 服务脚本
[root@edu-dfs-tracker-01 ~]# ll /etc/init.d/ |grep dfs -rwxr-xr-x 1 root root 1186 Jan 1 18:57 fdfs_storaged -rwxr-xr-x 1 root root 1186 Jan 1 18:57 fdfs_trackerd [root@edu-dfs-tracker-01 ~]#
9.2 配置文件样例
[root@edu-dfs-tracker-01 ~]# cd /etc/fdfs/ [root@edu-dfs-tracker-01 fdfs]# ll total 20 -rw-r--r-- 1 root root 1461 Jan 1 18:57 client.conf.sample -rw-r--r-- 1 root root 7829 Jan 1 18:57 storage.conf.sample -rw-r--r-- 1 root root 7102 Jan 1 18:57 tracker.conf.sample [root@edu-dfs-tracker-01 fdfs]#
9.3命令工具在/usr/bin 下
[root@edu-dfs-tracker-01 bin]# pwd /usr/bin [root@edu-dfs-tracker-01 bin]# ll |grep dfs -rwxr-xr-x 1 root root 322736 Jan 1 18:57 fdfs_appender_test -rwxr-xr-x 1 root root 322512 Jan 1 18:57 fdfs_appender_test1 -rwxr-xr-x 1 root root 309368 Jan 1 18:57 fdfs_append_file -rwxr-xr-x 1 root root 308696 Jan 1 18:57 fdfs_crc32 -rwxr-xr-x 1 root root 309392 Jan 1 18:57 fdfs_delete_file -rwxr-xr-x 1 root root 310160 Jan 1 18:57 fdfs_download_file -rwxr-xr-x 1 root root 309752 Jan 1 18:57 fdfs_file_info -rwxr-xr-x 1 root root 327672 Jan 1 18:57 fdfs_monitor -rwxr-xr-x 1 root root 1132136 Jan 1 18:57 fdfs_storaged -rwxr-xr-x 1 root root 332680 Jan 1 18:57 fdfs_test -rwxr-xr-x 1 root root 331896 Jan 1 18:57 fdfs_test1 -rwxr-xr-x 1 root root 466000 Jan 1 18:57 fdfs_trackerd -rwxr-xr-x 1 root root 310352 Jan 1 18:57 fdfs_upload_appender -rwxr-xr-x 1 root root 311376 Jan 1 18:57 fdfs_upload_file [root@edu-dfs-tracker-01 bin]#
10 修改启动配置文件 两台机器都得替换
sed -i "s#/usr/local/bin#/usr/bin#g" /etc/init.d/fdfs_trackerd sed -i "s#/usr/local/bin#/usr/bin#g" /etc/init.d/fdfs_storaged
11.tarcker节点的配置192.168.56.121
[root@edu-dfs-tracker-01 tracker]# cd /etc/fdfs/ [root@edu-dfs-tracker-01 fdfs]# ls client.conf.sample storage.conf.sample tracker.conf tracker.conf.sample [root@edu-dfs-tracker-01 fdfs]# co tracker.conf.sample tracker.conf [root@edu-dfs-tracker-01 fdfs]# vi tracker.conf #配置文件讲解具体去官网看 base_path=/fastdfs/tracker [root@edu-dfs-tracker-01 fdfs]#mkdir -p /fastdfs/tracker 启动tracker节点: /etc/init.d/fdfs_trackerd start [root@edu-dfs-tracker-01 fdfs]# ps -ef |grep fdfs root 18420 1 0 20:09 ? 00:00:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf root 18436 10218 0 20:26 pts/0 00:00:00 grep --color=auto fdfs [root@edu-dfs-tracker-01 fdfs]# [root@edu-dfs-tracker-01 fdfs]# cd /fastdfs/tracker/ [root@edu-dfs-tracker-01 tracker]# ll total 0 drwxr-xr-x 2 root root 80 Jan 1 20:10 data #自动生成的两个文件 drwxr-xr-x 2 root root 25 Jan 1 20:09 logs [root@edu-dfs-tracker-01 tracker]# 加入开机启动 [root@edu-dfs-tracker-01 tracker]# echo "/etc/init.d/fdfs_trackerd start">>/etc/rc.local
12.修改storage节点
[root@edu-dfs-storage-01 storage]# cd /etc/fdfs/ [root@edu-dfs-storage-01 fdfs]# cp storage.conf.sample storage.conf vi sotrage.conf port=23000 #不需要修改 http.server_port=8888 #不需要修改 这两个端口防火墙要打开 tracker_server=192.168.56.121:22122 #修改成tracker的ip store_path0=/fastdfs/storage #自定义目录 base_path=/fastdfs/storage #自定义目录
本文出自 “砖家博客” 博客,请务必保留此出处http://wsxxsl.blog.51cto.com/9085838/1887994
标签:fastdfs
原文地址:http://wsxxsl.blog.51cto.com/9085838/1887994