Es posible que desee usar un shell para interpretar la canalización y la redirección :Usaré un heredoc para facilitar las citas
XYZ=$(expect <<END_EXPECT
set timeout -1
spawn sh -c {python log-connector.py -s $strt -e $end -i 600 -a https://server:9000 -u someaccount -f./conf/firewall-fields2.txt -q./conf/query.txt -z | gzip >> /data/sources/results-$strt2-$end2.json.gz}
expect "Password:"
send "$pass\r"
expect eof
END_EXPECT
)
echo "$XYZ"
Если вы не хотите, чтобы данный узел запускал какие-либо контейнеры, вы можетеслитьего
docker node update swarm-01.local --availability drain
Это переместит любой контейнер, работающий в режиме swarm (кластера ), на любой другой доступный узел. Контейнеры, которые не поддерживают рой (, запущенные с помощью команды )docker run
, будут продолжать работать там.
Поведение, описанное в вашем втором вопросе, предназначено для того, чтобы избежать прерывания обслуживания конечного пользователя из-за ненужного смещения (остановки/запуска )контейнеров, для справки см.:https://docs.docker.com/engine/swarm/admin_guide/#force-the-swarm-to-rebalance
When you add a new node to a swarm, or a node reconnects to the swarm after a period of unavailability, the swarm does not automatically give a workload to the idle node. This is a design decision. If the swarm periodically shifted tasks to different nodes for the sake of balance, the clients using those tasks would be disrupted. The goal is to avoid disrupting running services for the sake of balance across the swarm. When new tasks start, or when a node with running tasks becomes unavailable, those tasks are given to less busy nodes. The goal is eventual balance, with minimal disruption to the end user.