如何将运行 seaweedFS 作为守护进程?
How to run seaweedFS as a daemon?
启动并测试了一个多服务器 seaweedFS 设置,效果很好:
./weed server -dir=/VolA,/VolB -s3 -s3.config=weed.json -s3.port=9001 -master.defaultReplication="010" -master.peers=ip1:9333,ip2:9333,ip3:9333 -ip=ip1 -dataCenter=ABC -rack=A -volume.max=100
./weed server -dir=/VolA,/VolB -s3 -s3.config=weed.json -s3.port=9001 -master.defaultReplication="010" -master.peers=ip1:9333,ip2:9333,ip3:9333 -ip=ip2 -dataCenter=ABC -rack=B -volume.max=100
./weed server -dir=/VolA,/VolB -s3 -s3.config=weed.json -s3.port=9001 -master.defaultReplication="010" -master.peers=ip1:9333,ip2:9333,ip3:9333 -ip=ip3 -dataCenter=ABC -rack=C -volume.max=100
但是,我没有看到任何关于如何将 seaweedFS 运行 保持为守护进程的文档。
即:目前我 运行 在远程 shell 中除草。关闭 shell 关闭杂草。
非常感谢任何指点
通过手动启动 systemd 服务解决了这个问题。
对于每个节点执行:(显然,替换为您自己的杂草特定命令)
# 1. Move `weed` to some directory the startup service can access. I used `/usr/local/bin/weed/`. Include `weed` and `weed.json` in that directory (ymmv)
mkdir /usr/local/bin/weed
mv weed /usr/local/bin/weed/weed
mv weed.json /usr/local/bin/weed/weed.json
# 2. Create a systemd service config:
cat > /etc/systemd/system/seaweedmaster.service <<EOM
[Unit]
Description=SeaweedFS Server
After=network.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/bin/weed/weed server -dir=/VolA,/VolB -s3 -s3.config=weed.json -s3.port=9001 -master.defaultReplication="010" -master.peers=ip1:9333,ip2:9333,ip3:9333 -ip=ip1 -dataCenter=ABC -rack=A -volume.max=100
WorkingDirectory=/usr/local/bin/weed/
SyslogIdentifier=seaweedfs-master
[Install]
WantedBy=multi-user.target
EOM
# 3. Reload, enable and start
sudo systemctl daemon-reload
sudo systemctl enable seaweedmaster
sudo systemctl start seaweedmaster
# 4. logging the output, one of many options:
journalctl -u seaweedmaster.service -b --no-pager
启动并测试了一个多服务器 seaweedFS 设置,效果很好:
./weed server -dir=/VolA,/VolB -s3 -s3.config=weed.json -s3.port=9001 -master.defaultReplication="010" -master.peers=ip1:9333,ip2:9333,ip3:9333 -ip=ip1 -dataCenter=ABC -rack=A -volume.max=100
./weed server -dir=/VolA,/VolB -s3 -s3.config=weed.json -s3.port=9001 -master.defaultReplication="010" -master.peers=ip1:9333,ip2:9333,ip3:9333 -ip=ip2 -dataCenter=ABC -rack=B -volume.max=100
./weed server -dir=/VolA,/VolB -s3 -s3.config=weed.json -s3.port=9001 -master.defaultReplication="010" -master.peers=ip1:9333,ip2:9333,ip3:9333 -ip=ip3 -dataCenter=ABC -rack=C -volume.max=100
但是,我没有看到任何关于如何将 seaweedFS 运行 保持为守护进程的文档。 即:目前我 运行 在远程 shell 中除草。关闭 shell 关闭杂草。
非常感谢任何指点
通过手动启动 systemd 服务解决了这个问题。
对于每个节点执行:(显然,替换为您自己的杂草特定命令)
# 1. Move `weed` to some directory the startup service can access. I used `/usr/local/bin/weed/`. Include `weed` and `weed.json` in that directory (ymmv)
mkdir /usr/local/bin/weed
mv weed /usr/local/bin/weed/weed
mv weed.json /usr/local/bin/weed/weed.json
# 2. Create a systemd service config:
cat > /etc/systemd/system/seaweedmaster.service <<EOM
[Unit]
Description=SeaweedFS Server
After=network.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/bin/weed/weed server -dir=/VolA,/VolB -s3 -s3.config=weed.json -s3.port=9001 -master.defaultReplication="010" -master.peers=ip1:9333,ip2:9333,ip3:9333 -ip=ip1 -dataCenter=ABC -rack=A -volume.max=100
WorkingDirectory=/usr/local/bin/weed/
SyslogIdentifier=seaweedfs-master
[Install]
WantedBy=multi-user.target
EOM
# 3. Reload, enable and start
sudo systemctl daemon-reload
sudo systemctl enable seaweedmaster
sudo systemctl start seaweedmaster
# 4. logging the output, one of many options:
journalctl -u seaweedmaster.service -b --no-pager