0%

在linux-aarch64下离线部署FastDFS集群

在linux-aarch64下离线部署FastDFS集群

环境及部署软件

名称 版本
操作系统 centos-aarch64-7.6.1810
fastdfs 6.06
nginx 1.19.1

一键部署包 wi-fastdfs-6.06-install.tar.gz

一键部署脚本

创建目录 mkdir /wisoft

上传wi-fastdfs-6.06-install.tar/wisoft

解压并执行脚本

1
2
3
cd /wisoft
tar -zxvf wi-fastdfs-6.06-install.tar
./wi-fastdfs-install.sh

单机部署完成,测试是否安装成功

1
2
3
4
[root@dfs-01 wisoft]# ps -ef |grep fdfs
root 14395 1 0 09:34 ? 00:00:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
root 14412 1 75 09:34 ? 00:00:43 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
root 14425 3502 0 09:35 pts/0 00:00:00 grep --color=auto fdfs

可以看到tracker和storage服务已经启动

访问 http://ip/ nginx欢迎页正常

附安装过程视频,供大家欣赏观摩

为减小视频大小,有提速,原过程大约30分钟

单机测试

修改nginx配置 代理fastdfs vi /usr/local/nginx/conf/nginx.conf

找到server 80段, 添加一条location规则

1
2
3
4
5
6
7
8
9
10
server {
listen 80;
server_name localhost;
...
location ~/group([0-9])/M00 {
root /wisoft/fastdfs/storage/data/M00;
ngx_fastdfs_module;
}
...
}

重载nginx服务 systemctl reload nginx

上传测试文件 fdfs_upload_file /etc/fdfs/client.conf /wisoft/fastdfs.gif

1
2
[root@dfs-01 ~]# fdfs_upload_file /etc/fdfs/client.conf /wisoft/fastdfs.gif
group1/M00/00/00/wKgB019RotyAT3AIAB2SpsQYKS0516.gif

根据返回的路径 group1/M00/00/00/wKgB019RotyAT3AIAB2SpsQYKS0516.gif在浏览器里面访问 http://192.168.1.210/group1/M00/00/00/wKgB019RotyAT3AIAB2SpsQYKS0516.gif

image

测试成功

集群配置

如上单机部署多台,分别作配置修改

修改 storage.conf 文件 增加 tracker_server 服务器地址

1
2
3
4
5
6
vi /etc/fdfs/storage.conf
base_path = /wisoft/fastdfs/storage
store_path0 = /wisoft/fastdfs/storage
tracker_server = 192.168.1.210:22122
tracker_server = 192.168.1.211:22122
tracker_server = 192.168.1.212:22122

修改 storage_ids.conf 文件 依次增加 服务器地址

1
2
3
100001   group1  192.168.1.210
100002 group1 192.168.1.211
100003 group1 192.168.1.212

重启 storage 服务 systemctl restart fdfs_storaged

并查看日志 tail -f /wisoft/fastdfs/storage/logs/storaged.log

1
2
3
4
5
6
7
8
9
10
11
12
[root@dfs-01 ~]# systemctl restart fdfs_storaged
[root@dfs-01 ~]# tail -f /wisoft/fastdfs/storage/logs/storaged.log
[2020-09-04 10:33:12] INFO - file: tracker_client_thread.c, line: 299, successfully connect to tracker server 192.168.1.212:22122, as a tracker client, my ip is 192.168.1.210
[2020-09-04 10:33:12] INFO - file: tracker_client_thread.c, line: 2044, tracker server: #0. 192.168.1.210:22122, my_report_result: -1
[2020-09-04 10:33:12] INFO - file: tracker_client_thread.c, line: 1411, tracker server 192.168.1.212:22122, set tracker leader: 192.168.1.212:22122
[2020-09-04 10:33:12] INFO - file: storage_sync_func.c, line: 114, successfully connect to storage server 192.168.1.211:23000
[2020-09-04 10:33:12] INFO - file: storage_sync_func.c, line: 114, successfully connect to storage server 192.168.1.212:23000
[2020-09-04 10:33:12] INFO - file: tracker_client_thread.c, line: 299, successfully connect to tracker server 192.168.1.210:22122, as a tracker client, my ip is 192.168.1.210
[2020-09-04 10:33:12] INFO - file: tracker_client_thread.c, line: 299, successfully connect to tracker server 192.168.1.211:22122, as a tracker client, my ip is 192.168.1.210
[2020-09-04 10:33:12] INFO - file: tracker_client_thread.c, line: 770, my status: 1 (WAIT_SYNC) from tracker #0 != my status: 7 (ACTIVE) from leader tracker #2, set report_my_status to true
[2020-09-04 10:33:13] INFO - file: tracker_client_thread.c, line: 2452, tracker server: 192.168.1.210:22122, try to set storage status from 1 (WAIT_SYNC) to 7 (ACTIVE)
[2020-09-04 10:33:14] INFO - file: tracker_client_thread.c, line: 299, successfully connect to tracker server 192.168.1.210:22122, as a tracker client, my ip is 192.168.1.210

可以看到顺利连接到其他服务器的日志信息

集群测试

分别访问不同的服务器查看单机部署时测试的文件是否被同步

image

如此 集群部署完成