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.主机名解析
[[email protected] src]# cat /etc/hosts 192.168.56.121 edu-dfs-tracker-01 192.168.56.125 edu-dfs-storage-01
4.上传所需要的安装包 看主机名哪台服务器
tracker:
[[email protected] 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 [[email protected] src]#
storage:
[[email protected] 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 [[email protected] 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 ##### [[email protected] 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 [[email protected] 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 服务脚本
[[email protected] ~]# 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 [[email protected] ~]#
9.2 配置文件样例
[[email protected] ~]# cd /etc/fdfs/ [[email protected] 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 [[email protected] fdfs]#
9.3命令工具在/usr/bin 下
[[email protected] bin]# pwd /usr/bin [[email protected] 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 [[email protected] 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
[[email protected] tracker]# cd /etc/fdfs/ [[email protected] fdfs]# ls client.conf.sample storage.conf.sample tracker.conf tracker.conf.sample [[email protected] fdfs]# co tracker.conf.sample tracker.conf [[email protected] fdfs]# vi tracker.conf #配置文件讲解具体去官网看 base_path=/fastdfs/tracker [[email protected] fdfs]#mkdir -p /fastdfs/tracker 启动tracker节点: /etc/init.d/fdfs_trackerd start [[email protected] 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 [[email protected] fdfs]# [[email protected] fdfs]# cd /fastdfs/tracker/ [[email protected] 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 [[email protected] tracker]# 加入开机启动 [[email protected] tracker]# echo "/etc/init.d/fdfs_trackerd start">>/etc/rc.local
12.修改storage节点
[[email protected] storage]# cd /etc/fdfs/ [[email protected] 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 #自定义目录
时间: 2024-10-29 19:12:01