-
Notifications
You must be signed in to change notification settings - Fork 767
通过systemctl启动gofastdfs
首先克隆go-fastdfs文件夹下来: git clone https://github.com/sjqzhang/go-fastdfs.git 查看目前文件结构,当前目录可以看到有gofastdfs.service文件 cd go-fastdfs && ls 拷贝gofastdfs.service到systemctl服务启动目录 cp gofastdfs.service /usr/lib/systemd/system/
编辑启动文件 vim /usr/lib/systemd/system/gofastdfs.service 需要更改[Service]中如下几项: $go-fastdfs_dir=你的go-fastdfs文件路径 PIDFile=$go-fastdfs_dir/conf/app.pid Environment="GO_FASTDFS_DIR=$go-fastdfs_dir" ExecStart=$go-fastdfs_dir/fileserver $GO_FASTDFS_DIR 加载启动文件 systemctl daemon-reload
我们会发现上面启动文件中需要fileserver启动, 接下来下载fileserver 二进制文件(建议下载最新的。目前是1.2.8) wget --no-check-certificate https://github.com/sjqzhang/go-fastdfs/releases/download/v1.2.8/fileserver ; chmod +x fileserver
开启启动gofastdfs服务 systemctl start gofastdfs
服务启动后会自动生成conf目录和data目录 conf/cfg.json是主要配置文件 #以下几项日常配置项需要特别注意,小张的每行配置都有相应的国语注释,很赞!!! "PeerID": "集群内唯一,请使用0-9的单字符,默认自动生成", "peer_id": "1", "本主机地址": "本机http地址,默认自动生成, "host": "http://192.168.x.x:8080", "集群": "集群列表,注意为了高可用,IP必须不能是同一个,同一不会自动备份,且必须为内网IP, "peers": ["http://192.168.1.1:8080","http://192.168.1.2:8080","http://192.168.1.3:8080"], "组号": "用于区别不同的集群, "group": "group1", "下载域名": "用于外网下载文件的域名,不包含http://", "download_domain": "godfs.xxxx.com", "support_group_manage": true, "管理ip列表": "用于管理集的ip白名单,如管理者电脑本机IP", "admin_ips": ["172.16.x.x"], #systemctl restart gofastdfs