GoFastDFS单节点部署

2023-10-17 17:58:01 浏览数 (2)

GoFastDFS单节点部署

操作环境

IP地址

操作环境

运行资源

备注

192.168.8.88

Centos7.5

2C8G

JDK、GoFastDFS

一、安装JDK环境


1.1 上传安装包

1.2 解压安装包

代码语言:javascript复制
[root@localhost packages]# tar -zxf jdk-8u171-linux-x64.tar.gz -C /usr/local/
[root@localhost packages]# cd /usr/local
[root@localhost local]# mv jdk1.8.0_171/ java

1.3 编写环境变量文件

代码语言:javascript复制
[root@localhost local]# vim /etc/profile
#尾部添加
export JAVA_HOME=/usr/local/java
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
[root@localhost local]# source /etc/profile

1.4 验证JDK版本

代码语言:javascript复制
[root@localhost local]# java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

二、安装GoFastDFS


1.1 上传文件

1.2 启动生成配置文件

代码语言:javascript复制
[root@localhost ~]# cd /data/packages/go-fdfs/
[root@localhost go-fdfs]# chmod  x fileserver 
[root@localhost go-fdfs]# ./fileserver
Listen on :8080
...
Ctrl C退出程序,配置文件已经生成
[root@localhost go-fdfs]# ls
conf  data  files  fileserver  log  static

1.3 修改配置文件

代码语言:javascript复制
[root@localhost ~]# vim /data/packages/go-fdfs/conf/cfg.json
##前面的为行号 以实际文件为准
  3         "addr": ":8080",
  9         "host": "http://192.168.8.88:8080"
 11         "peers": ["http://192.168.8.88:8080"],
 25         "enable_web_upload": false,
 35         "show_dir": false,
 61         "enable_cross_origin": false,
 19         "extensions": [".jpg",".jpeg",".png",".gif",".bmp",".webp",".mp4",".avi",".wmv",".mov",".ogg",".rmvb",".rm",".mpeg",".mpg",".flv",".3gp",".mp3",".wma",".",".doc",".xls",".ppt",".docx",".xlsx",".pptx",".txt",".zip",".rar",".pdf",".apk"],

1.4 启动测试访问

后台启动

代码语言:javascript复制
cd /data/packages/go-fdfs
nohup ./fileserver &

关闭防火墙

代码语言:javascript复制
systemctl stop firewalld && systemctl disable firewalld

测试访问http://192.168.8.88:8080

使用命令上传测试

代码语言:javascript复制
[root@localhost ~]# echo "互联网-小阿宇" > 测试.txt
#使用绝对路径或者相对路径都可以
[root@localhost ~]# curl -F "file=@/root/测试.txt" http://192.168.8.88:8080/group1/upload
http://192.168.8.88:8080/group1/default/20230811/10/38/2/测试.txt

浏览器访问返回的路径,可以将文件下载到桌面进行验证

0 人点赞