载入天数... 载入时分秒... (*๓´╰╯`๓)
李星辰
发布于 2022-10-07 / 17 阅读 / 0 评论 / 0 点赞

fastdfs单点部署

1、上传fastdfs-5.11.tar.gz、fastdfs-nginx-module-1.20.tar.gz、libfastcommon-1.0.39.tar.gz至172.20.46:/data/packages/fdfs目录下

2、解压安装libfastcommon-1.0.39.tar.gz

  tar xf libfastcommon-1.0.39.tar.gz

  cd libfastcommon-1.0.39

执行安装脚本


   ./make.sh
   ./make.sh install

3、创建so文件软链

    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 

4、解压安装主服务

   tar -zxvf V5.05.tar.gz
   cd fastdfs-5.05

执行安装脚本

    ./make.sh
    ./make.sh install

5、修改主服务配置文件

    cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf #tracker节点
    cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf #storage节点
    cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf #客户端文件,测试用
    cp /data/packages/fdfs/fastdfs-5.11/conf/http.conf /etc/fdfs/ #供nginx访问使用
    cp /data/packages/fdfs/fastdfs-5.11/conf/mime.types /etc/fdfs/ #供nginx访问使用

    vim /etc/fdfs/tracker.conf
   #需要修改的内容如下
   port=22122 # tracker服务器端口(默认22122,一般不修改)
   base_path=/data/fastdfs # 存储日志和数据的根目录
   
   #需要修改的内容如下
   vim /etc/fdfs/storage.conf
   port=23000 # storage服务端口(默认23000,一般不修改)
   base_path=/data/fastdfs # 数据和日志文件存储根目录
   store_path0=/data/fastdfs # 第一个存储目录
   tracker_server=192.168.0.1:22122 # tracker服务器IP和端口
   tracker_server=192.168.0.2:22122 # tracker服务器IP和端口
   http.server_port=8888 # http访问文件的端口(默认8888,看情况修改,和nginx中保持一致)
#编辑启动文件 
vim /usr/lib/systemd/system/fastdfs-storage.service
[Unit]
Description=The FastDFS File server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStart=/usr/bin/fdfs_storaged /etc/fdfs/storage.conf start
ExecStop=/usr/bin/fdfs_storaged /etc/fdfs/storage.conf stop
ExecRestart=/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

[Install]
WantedBy=multi-user.target

#保存上方文件,重新载入配置
 systemctl daemon-reload
 systemctl enable fastdfs-storage.service
 systemctl start fastdfs-storage.service

6、查看服务状态

 fdfs_monitor /etc/fdfs/storage.conf list
[2018-11-06 00:00:00] DEBUG - base_path=/data/fastdfs/storage, connect_timeout=30, network_timeout=60, tracker_server_count=2, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
server_count=2, server_index=0
tracker server is 192.168.0.1:22122
group count: 1
Group 1:
…


7、修改客户端配置

vim /etc/fdfs/client.conf
#需要修改的内容如下
base_path=/data/fastdfs
tracker_server=192.168.0.1:22122 # tracker服务器IP和端口
tracker_server=192.168.0.2:22122 # tracker服务器IP和端口

#保存后测试,返回ID表示成功 如:group1/M00/00/00/xx.tar.gz
 fdfs_upload_file /etc/fdfs/client.conf testfile
#上传成功服务部署完毕

8、如果安装失败

1.清理,执行如下命令
./make.sh clean
2.再次编译安装
./make.sh && ./make.sh install

评论