Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4872db2

Browse files
committed
Clarified HOSTNAME environment variable
1 parentffe9dff commit4872db2

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

‎messenger.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -904,10 +904,10 @@ serializer How to serialize the final payload ``Redis::SERIALIZER_PHP`
904904

905905
At some point you'll likely want to scale the number of workers working on your queue.
906906
Make sure you assign the correct ``consumer`` and ``group`` values in that case.
907-
The more likely case is thateachworkershall work on the queue independently, reducing
907+
The more likely case is thatyou want everyworkerto work on the queue independently, reducing
908908
the time needed to process the pending messages. In that case, every single worker
909-
must have a different ``consumer``configuration value. When working with Docker
910-
containers one idea might be to use the ``HOSTNAME`` environment variable:
909+
must have a different ``consumer``option value so Redis can identify the different workers.
910+
When working with Dockercontainers one idea might be to use the ``HOSTNAME`` environment variable:
911911

912912
..configuration-block::
913913

@@ -923,6 +923,16 @@ serializer How to serialize the final payload ``Redis::SERIALIZER_PHP`
923923
That means messages would be processed multiple times. In that case, you must have different ``group``
924924
configurations.
925925

926+
..caution::
927+
928+
Be careful when using the ``HOSTNAME`` environment variable in orchestrated environments such as Kubernetes or
929+
Docker Swarm. It usually contains a random unique identifier which means if you destroy a container while it was
930+
working on a message, this message will remain in pending state forever as it is very unlikely there's ever going
931+
to be another worker with exactly the same ``HOSTNAME`` as the one you destroyed. In other words, you have to make
932+
sure you're using deterministic ``HOSTNAME`` values such as ``worker-1``, ``worker-2`` etc.
933+
In case you are using Kubernetes to orchestrate your containers, consider using a ``StatefulSet`` rather than
934+
a ``Deployment`` for example.
935+
926936
In Memory Transport
927937
~~~~~~~~~~~~~~~~~~~
928938

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp