From 9f6641235ae27a383d206dc6bac819ab19c5355b Mon Sep 17 00:00:00 2001 From: Loong Date: Fri, 26 Apr 2024 16:39:19 +0800 Subject: [PATCH] dlb: add how to use Signed-off-by: Loong --- .../_include/dlb_example_config.yaml | 45 ++++++++++++++ .../root/configuration/other_features/dlb.rst | 59 ++++++++++++++++++- 2 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 docs/root/configuration/other_features/_include/dlb_example_config.yaml diff --git a/docs/root/configuration/other_features/_include/dlb_example_config.yaml b/docs/root/configuration/other_features/_include/dlb_example_config.yaml new file mode 100644 index 0000000000000..e6961d316ce51 --- /dev/null +++ b/docs/root/configuration/other_features/_include/dlb_example_config.yaml @@ -0,0 +1,45 @@ +static_resources: + listeners: + - address: + socket_address: + address: 0.0.0.0 + port_value: 10000 + connection_balance_config: + extend_balance: + name: envoy.network.connection_balance.dlb + typed_config: + "@type": type.googleapis.com/envoy.extensions.network.connection_balance.dlb.v3alpha.Dlb + filter_chains: + - filters: + - name: envoy.filters.network.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + codec_type: AUTO + stat_prefix: ingress_http + route_config: + name: local_route + virtual_hosts: + - name: backend + domains: + - "*" + routes: + - match: + prefix: "/" + route: + cluster: service1 + http_filters: + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router + + clusters: + - name: service1 + load_assignment: + cluster_name: service1 + endpoints: + - lb_endpoints: + - endpoint: + address: + socket_address: + address: 127.0.0.1 + port_value: 12000 diff --git a/docs/root/configuration/other_features/dlb.rst b/docs/root/configuration/other_features/dlb.rst index 4cde5ddbc2fa9..eb619aaa926db 100644 --- a/docs/root/configuration/other_features/dlb.rst +++ b/docs/root/configuration/other_features/dlb.rst @@ -33,7 +33,60 @@ If enabled, the Dlb connection balancer will: When new connections come, one worker thread will accept it and send it to Dlb hardware. Dlb hardware does balancing then trigger one worker thread to receive via libevent. -Installing and using Dlb ------------------------- +Installing Dlb +-------------- -For information on how to build/install and use libdlb see `the getting started guide `_. +Download DLB driver release tarball from `dlb website `_, then install it refer to `the getting started guide `_. + + +Using Dlb +--------- + +Create a config file to make Envoy listen 10000 port as proxy, the upstream server listens 12000 port. + +.. literalinclude:: _include/dlb_example_config.yaml + :language: yaml + +Run the upstream service: + +.. code-block:: bash + +$ docker run -d -p 12000:80 nginx + +Run Envoy with dlb enabled: + +.. code-block:: bash + +$ ./envoy --concurrency 2 -c dlb-config.yaml + +Test: + +.. code-block:: bash + +$ curl localhost:10000 + +You should get output from Nginx like below: +.. code-block:: text + + + +Welcome to nginx! + + + +

Welcome to nginx!

+

If you see this page, the nginx web server is successfully installed and +working. Further configuration is required.

+ +

For online documentation and support please refer to +nginx.org.
+Commercial support is available at +nginx.com.

+ +

Thank you for using nginx.

+ +