第2-1-2章 传统方式安装FastDFS-附FastDFS常用命令( 三 )

设置开机启动:
chkconfig fdfs_trackerd on或systemctl enable fdfs_trackerd.service或者:vim /etc/rc.d/rc.local/etc/init.d/fdfs_trackerd start#加入配置Tracker服务启动成功后 , 会在base_path下创建data、logs两个目录 。目录结构如下:
${base_path}|__data| |__storage_groups.dat:存储分组信息| |__storage_servers.dat:存储服务器列表|__logs| |__trackerd.log: tracker server 日志文件3.6 配置FastDFS Storage3.6.1 配置Storage进入 /etc/fdfs 目录 , 复制 FastDFS 存储器样例配置文件 storage.conf.sample , 并重命名为 storage.conf
[root@node5-vm10 ~]# cd /etc/fdfs/[root@node5-vm10 fdfs]# cp storage.conf.sample storage.conf[root@node5-vm10 fdfs]# vim storage.conf修改以下配置信息 , 其他默认即可:
# Storage 数据和日志目录地址(根目录必须存在 , 子目录会自动生成)# 这里不是上传的文件存放的地址base_path =/home/fastdfs/storage# 逐一配置 store_path_count 个路径 , 索引号基于 0 。# 如果不配置 store_path0 , 那它就和 base_path 对应的路径一样 。store_path0 =/home/fastdfs/storage/base# FastDFS 存储文件时 , 采用了两级目录 。这里配置存放文件的目录个数 。# 如果本参数只为 N(如: 256) , 那么 storage server 在初次运行时 , 会在 store_path 下自动创建 N * N 个存放文件的子目录 。subdir_count_per_path=256# tracker_server 的列表  , 会主动连接 tracker_server# 有多个 tracker server 时 , 每个 tracker server 写一行tracker_server = 172.17.0.115:22122#访问端口 默认8888http.server_port = 8188【第2-1-2章 传统方式安装FastDFS-附FastDFS常用命令】创建Storage基础数据目录 , 对应base_path目录
# 对应base_path[root@node5-vm10 fdfs]# mkdir -p/home/fastdfs/storage# 这是配置的store_path0路径 , 有多个要创建多个mkdir -p/home/fastdfs/storage/base3.6.2 启动与关闭启动Storage前确保Tracker是启动的 , 可以用以下任一方式启动Storage:
/etc/init.d/fdfs_storaged start或service fdfs_storaged start或systemctl start fdfs_storaged查看 Storage 是否成功启动:
[root@node5-vm10 ~]# netstat -unltp|grep 23000tcp00 0.0.0.0:230000.0.0.0:*LISTEN28737/fdfs_storaged [root@node5-vm10 ~]# systemctl status fdfs_storaged● fdfs_storaged.service - LSB: FastDFS storage serverLoaded: loaded (/etc/rc.d/init.d/fdfs_storaged; bad; vendor preset: disabled)Active: active (running) since Fri 2020-04-03 11:59:31 CST; 39min agoDocs: man:systemd-sysv-generator(8)Process: 28716 ExecStop=/etc/rc.d/init.d/fdfs_storaged stop (code=exited, status=2)Process: 28734 ExecStart=/etc/rc.d/init.d/fdfs_storaged start (code=exited, status=0/SUCCESS)Memory: 66.9MCGroup: /system.slice/fdfs_storaged.service└─28737 /usr/bin/fdfs_storaged /etc/fdfs/storage.confApr 03 11:59:31 node5-vm10.xxzx systemd[1]: Starting LSB: FastDFS storage server...Apr 03 11:59:31 node5-vm10.xxzx systemd[1]: Started LSB: FastDFS storage server.Apr 03 11:59:31 node5-vm10.xxzx fdfs_storaged[28734]: Starting FastDFS storage server:使用以下任一命令关闭Storage:

  • service fdfs_storaged stop
  • systemctl stop fdfs_storaged
  • /etc/init.d/ fdfs_storaged stop
查看Storage和Tracker是否在通信:
[root@node5-vm10 ~]# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf[2020-04-03 12:41:17] DEBUG - base_path=/fastdfs/storage, connect_timeout=5, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=1, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0server_count=1, server_index=0tracker server is 172.17.0.115:22122group count: 1Group 1:group name = group1disk total space = 196,011 MBdisk free space = 29,774 MB...

经验总结扩展阅读