我正在尝试创建一个 postgres 数据容器,并使其充当主 postgres 单元的助手,以便主单元可以共享数据容器的卷。尝试启动主单元会导致其中一个主机与我的集群断开连接。以下是单元文件:
[Unit]
Description=A postgres database. Uses [email protected] as a data container.
Requires=etcd.service
Requires=docker.service
Requires=postgres-db-data@%i.service
After=etcd.service
After=docker.service
Before=postgres-db-data@%i.service
[Service]
TimeoutStartSec=0
KillMode=none
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker kill postgres%i
ExecStartPre=-/usr/bin/docker rm postgres%i
ExecStartPre=/usr/bin/docker pull ncodes/postgres
ExecStart=/usr/bin/docker run -volumes-from postgres-db-data@%i.service --name postgres%i -e POSTGRES_PASSWORD=mysecretpassword -e DB_NAME=database1 -p ${COREOS_PUBLIC_IPV4}:%i:5432 ncodes/postgres
ExecStop=/usr/bin/docker stop postgres%i
[X-Fleet]
X-Conflicts=postgres-db@*.service
[Unit]
Description=A postgres database
BindsTo=postgres-db@%i.service
# Requirements
Requires=etcd.service
Requires=docker.service
Requires=postgres-db@%i.service
# ordering
After=etcd.service
After=docker.service
After=postgres-db@%i.service
[Service]
TimeoutStartSec=0
KillMode=none
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker kill postgres-data-%i
ExecStartPre=-/usr/bin/docker rm postgres-data-%i
ExecStartPre=/usr/bin/docker pull ncodes/postgres
ExecStart=/usr/bin/docker run --name postgres-data-%i -e POSTGRES_PASSWORD=mysecretpassword -e DB_NAME=database2 ncodes/postgres
ExecStop=/usr/bin/docker stop postgres-data-%i
[X-Fleet]
X-ConditionMachineOf=postgres-db@%i.service
舰队日志:journalctl -u fleet
Dec 07 10:53:52 coreos01 systemd[1]: Started fleet daemon.
Dec 07 10:53:52 coreos01 fleetd[813]: INFO fleetd.go:64: Starting fleetd version 0.11.5
Dec 07 10:53:52 coreos01 fleetd[813]: INFO fleetd.go:168: No provided or default config file found - proceeding without
Dec 07 10:53:52 coreos01 fleetd[813]: INFO server.go:157: Establishing etcd connectivity
Dec 07 10:55:00 coreos01 fleetd[813]: INFO server.go:168: Starting server components
Dec 07 10:55:00 coreos01 fleetd[813]: INFO engine.go:79: Engine leader is 6fbfd62531ce435ca99ed7aa318b7220
Dec 07 11:09:18 coreos01 fleetd[813]: INFO manager.go:246: Writing systemd unit [email protected] (561b)
Dec 07 11:09:18 coreos01 fleetd[813]: INFO manager.go:182: Instructing systemd to reload units
Dec 07 11:09:19 coreos01 fleetd[813]: INFO manager.go:127: Triggered systemd unit [email protected] start: job=3192
Dec 07 11:09:19 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=LoadUnit [email protected] reason="unit scheduled here but not loaded"
Dec 07 11:09:19 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=ReloadUnitFiles job=N/A reason="always reload unit files"
Dec 07 11:09:19 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=StartUnit [email protected] reason="unit currently loaded but desired state is
Dec 07 11:13:29 coreos01 fleetd[813]: INFO manager.go:138: Triggered systemd unit [email protected] stop: job=4131
Dec 07 11:13:29 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=StopUnit [email protected] reason="unit currently launched but desired state i
Dec 07 11:13:49 coreos01 fleetd[813]: INFO manager.go:138: Triggered systemd unit [email protected] stop: job=4219
Dec 07 11:13:49 coreos01 fleetd[813]: INFO manager.go:259: Removing systemd unit [email protected]
Dec 07 11:13:49 coreos01 fleetd[813]: INFO manager.go:182: Instructing systemd to reload units
Dec 07 11:13:49 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=UnloadUnit [email protected] reason="unit loaded but not scheduled here"
Dec 07 11:13:49 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=ReloadUnitFiles job=N/A reason="always reload unit files"
Dec 07 12:08:21 coreos01 fleetd[813]: INFO engine.go:79: Engine leader is 6e0e59c83bd7450e8c8e22c36ee1cf3a
Dec 07 12:08:26 coreos01 fleetd[813]: INFO manager.go:246: Writing systemd unit [email protected] (750b)
Dec 07 12:08:26 coreos01 fleetd[813]: INFO manager.go:182: Instructing systemd to reload units
Dec 07 12:08:26 coreos01 fleetd[813]: ERROR manager.go:129: Failed to trigger systemd unit [email protected] start: Unit [email protected] failed to load: No such file or dir
Dec 07 12:08:26 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=LoadUnit [email protected] reason="unit scheduled here but not loaded"
Dec 07 12:08:26 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=ReloadUnitFiles job=N/A reason="always reload unit files"
Dec 07 12:08:26 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=StartUnit [email protected] reason="unit currently loaded but desired state is launc
Dec 07 12:08:27 coreos01 fleetd[813]: INFO manager.go:246: Writing systemd unit [email protected] (676b)
Dec 07 12:08:27 coreos01 fleetd[813]: INFO manager.go:182: Instructing systemd to reload units
Dec 07 12:08:27 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=LoadUnit [email protected] reason="unit scheduled here but not loaded"
Dec 07 12:08:27 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=ReloadUnitFiles job=N/A reason="always reload unit files"
Dec 07 12:29:37 coreos01 fleetd[813]: INFO manager.go:138: Triggered systemd unit [email protected] stop: job=12320
Dec 07 12:29:37 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=StopUnit [email protected] reason="unit currently launched but desired state is load
Dec 07 12:29:48 coreos01 fleetd[813]: INFO manager.go:127: Triggered systemd unit [email protected] start: job=12322
Dec 07 12:29:48 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=StartUnit [email protected] reason="unit currently loaded but desired state is launc
Dec 07 12:29:50 coreos01 fleetd[813]: INFO engine.go:159: Updated cluster engine version from 0 to 1
Dec 07 12:29:50 coreos01 fleetd[813]: INFO engine.go:185: Engine leadership acquired
Dec 07 12:29:50 coreos01 fleetd[813]: INFO engine.go:81: Engine leadership changed from 6e0e59c83bd7450e8c8e22c36ee1cf3a to ca376ee32b42401087d3cb6acfd4d6fc
Dec 07 12:29:53 coreos01 fleetd[813]: INFO manager.go:138: Triggered systemd unit [email protected] stop: job=12499
Dec 07 12:29:53 coreos01 fleetd[813]: INFO manager.go:259: Removing systemd unit [email protected]
Dec 07 12:29:53 coreos01 fleetd[813]: INFO manager.go:138: Triggered systemd unit [email protected] stop: job=12501
Dec 07 12:29:53 coreos01 fleetd[813]: INFO manager.go:259: Removing systemd unit [email protected]
Dec 07 12:29:53 coreos01 fleetd[813]: INFO manager.go:182: Instructing systemd to reload units
Dec 07 12:29:53 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=UnloadUnit [email protected] reason="unit loaded but not scheduled here"
Dec 07 12:29:53 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=UnloadUnit [email protected] reason="unit loaded but not scheduled here"
Dec 07 12:29:53 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=ReloadUnitFiles job=N/A reason="always reload unit files"
Dec 07 12:30:28 coreos01 fleetd[813]: INFO engine.go:271: Scheduled Unit([email protected]) to Machine(ca376ee32b42401087d3cb6acfd4d6fc)
Dec 07 12:30:28 coreos01 fleetd[813]: INFO reconciler.go:161: EngineReconciler completed task: {Type: AttemptScheduleUnit, JobName: [email protected], MachineID: ca376ee32b42401087d3cb6a
Dec 07 12:30:33 coreos01 fleetd[813]: INFO manager.go:246: Writing systemd unit [email protected] (750b)
Dec 07 12:30:33 coreos01 fleetd[813]: INFO manager.go:182: Instructing systemd to reload units
Dec 07 12:30:33 coreos01 fleetd[813]: ERROR manager.go:129: Failed to trigger systemd unit [email protected] start: Unit [email protected] failed to load: No such file or dir
Dec 07 12:30:33 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=LoadUnit [email protected] reason="unit scheduled here but not loaded"
Dec 07 12:30:33 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=ReloadUnitFiles job=N/A reason="always reload unit files"
Dec 07 12:30:33 coreos01 fleetd[813]: INFO reconcile.go:330: AgentReconciler completed task: type=StartUnit [email protected] reason="unit currently loaded but desired state is launc