mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
99 lines
3.8 KiB
Desktop File
99 lines
3.8 KiB
Desktop File
# Template unit: one instance per volume on this host,
|
|
# sw-blockvolume@<volume>.service, as `sw-block volume start <volume>` writes
|
|
# and starts it. Settings: /etc/sw-block/volumes/<volume>.env (the same keys
|
|
# as deploy/config/blockvolume.env), each instance with its own state
|
|
# directory (/var/lib/sw-block-volume/<volume>; SWB_DURABLE_ROOT inside it),
|
|
# ports and NQN. The volume id is the instance name (--volume-id=%i): the
|
|
# settings file's SWB_VOLUME_ID is not read, so the two cannot differ.
|
|
# Apart from the lines marked "per instance" this unit is
|
|
# sw-blockvolume.service; a test keeps the two the same.
|
|
[Unit]
|
|
StartLimitIntervalSec=600
|
|
StartLimitBurst=10
|
|
# per instance
|
|
Description=Seaweed Block volume %i (one replica)
|
|
Documentation=https://github.com/seaweedfs/seaweed-block
|
|
After=network-online.target sw-blockmaster.service
|
|
Wants=network-online.target sw-blockmaster.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
# Per-volume cgroup ceiling, not a host-wide budget. The default Go soft
|
|
# limit is 90%: 1843 MiB here. Size each holder and the host's total separately.
|
|
MemoryMax=2G
|
|
User=sw-block
|
|
Group=sw-block
|
|
# per instance
|
|
EnvironmentFile=/etc/sw-block/volumes/%i.env
|
|
# systemd creates /var/lib/sw-block-volume/<volume> owned by User/Group;
|
|
# SWB_DURABLE_ROOT must be inside it. It is separate from blockmaster's
|
|
# state directory and from every other volume's.
|
|
# per instance
|
|
StateDirectory=sw-block-volume/%i
|
|
StateDirectoryMode=0750
|
|
ExecStart=/usr/local/bin/blockvolume \
|
|
--master=${SWB_MASTER_ADDR} \
|
|
--server-id=${SWB_SERVER_ID} \
|
|
--volume-id=%i \
|
|
--replica-id=${SWB_REPLICA_ID} \
|
|
--data-addr=${SWB_DATA_ADDR} \
|
|
--ctrl-addr=${SWB_CTRL_ADDR} \
|
|
--status-addr=${SWB_STATUS_ADDR} \
|
|
--heartbeat-interval=${SWB_HEARTBEAT_INTERVAL} \
|
|
--recover-timeout=${SWB_RECOVER_TIMEOUT} \
|
|
--durable-root=${SWB_DURABLE_ROOT} \
|
|
--durable-impl=${SWB_DURABLE_IMPL} \
|
|
--durable-blocks=${SWB_DURABLE_BLOCKS} \
|
|
--durable-blocksize=${SWB_DURABLE_BLOCKSIZE} \
|
|
--nvme-listen=${SWB_NVME_LISTEN} \
|
|
--nvme-subsysnqn=${SWB_NVME_SUBSYSNQN} \
|
|
--nvme-ns=${SWB_NVME_NS} \
|
|
--nvme-max-h2c-data-length=${SWB_NVME_MAX_H2C_DATA_LENGTH} \
|
|
--ublk-device=${SWB_UBLK_DEVICE} \
|
|
--ublk-queues=${SWB_UBLK_QUEUES} \
|
|
--ublk-queue-depth=${SWB_UBLK_QUEUE_DEPTH} \
|
|
--iscsi-listen=${SWB_ISCSI_LISTEN} \
|
|
--iscsi-iqn=${SWB_ISCSI_IQN} \
|
|
--iscsi-portal-addr=${SWB_ISCSI_PORTAL_ADDR} \
|
|
--iscsi-lun=${SWB_ISCSI_LUN} \
|
|
--iscsi-dataout-timeout=${SWB_ISCSI_DATAOUT_TIMEOUT} \
|
|
--replication-ack=${SWB_REPLICATION_ACK} \
|
|
--wal-retention-lsns=${SWB_WAL_RETENTION_LSNS} \
|
|
--recovery-mode=${SWB_RECOVERY_MODE} \
|
|
--degraded-probe-interval=${SWB_DEGRADED_PROBE_INTERVAL} \
|
|
--degraded-probe-cooldown-base=${SWB_DEGRADED_PROBE_COOLDOWN_BASE} \
|
|
--degraded-probe-cooldown-cap=${SWB_DEGRADED_PROBE_COOLDOWN_CAP} \
|
|
--chunk-filer=${SWB_CHUNK_FILER} \
|
|
--chunk-path=${SWB_CHUNK_PATH} \
|
|
--chunk-collection=${SWB_CHUNK_COLLECTION} \
|
|
--chunk-replication=${SWB_CHUNK_REPLICATION} \
|
|
--chunk-capture-interval=${SWB_CHUNK_CAPTURE_INTERVAL} \
|
|
--chunk-snapshot-schedule=${SWB_CHUNK_SNAPSHOT_SCHEDULE} \
|
|
--chunk-upload-concurrency=${SWB_CHUNK_UPLOAD_CONCURRENCY} \
|
|
--chunk-control-endpoint=${SWB_CHUNK_CONTROL_ENDPOINT} \
|
|
--workspace-lease=${SWB_WORKSPACE_LEASE} \
|
|
$SWB_VOLUME_EXTRA_ARGS
|
|
# blockvolume drains and closes on SIGTERM (a workspace lease closeout waits
|
|
# up to 3s).
|
|
KillSignal=SIGTERM
|
|
TimeoutStopSec=30s
|
|
Restart=on-failure
|
|
RestartPreventExitStatus=78 79
|
|
RestartSec=5s
|
|
|
|
NoNewPrivileges=true
|
|
ProtectSystem=strict
|
|
# The host volume locks (deploy/systemd/sw-block.tmpfiles.conf). Under
|
|
# ProtectSystem=strict blockvolume cannot create the directory itself.
|
|
ReadWritePaths=-/run/sw-block/locks
|
|
ProtectHome=true
|
|
PrivateTmp=true
|
|
PrivateDevices=true
|
|
ProtectKernelTunables=true
|
|
ProtectKernelModules=true
|
|
ProtectControlGroups=true
|
|
RestrictSUIDSGID=true
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|