]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix nginx-rgw docs 36646/head
authorofriedma <48631098+ofriedma@users.noreply.github.com>
Wed, 20 May 2020 16:07:03 +0000 (19:07 +0300)
committerNathan Cutler <ncutler@suse.com>
Sat, 15 Aug 2020 12:59:07 +0000 (14:59 +0200)
Signed-off-by: Or Friedmann <ofriedma@redhat.com>
Signed-off-by: Mark Kogan <mkogan@redhat.com>
(cherry picked from commit d73b879ac169c46f2dfeba0f4ca7f3a8af272a53)

doc/radosgw/rgw-cache.rst
examples/rgw-cache/nginx-default.conf
examples/rgw-cache/nginx-noprefetch.conf
examples/rgw-cache/nginx-slicing.conf
examples/rgw-cache/nginx.conf

index 11af120d814b18b33de65c0ef86e5ac8bdd65068..d28a73887fb874afb6357e937d726d0423397149 100644 (file)
@@ -7,7 +7,7 @@ RGW Data caching and CDN
 .. contents::
 
 This feature adds to RGW the ability to securely cache objects and offload the workload from the cluster, using Nginx.
-After an object is accessed the first time it will be stored in Nginx directory.
+After an object is accessed the first time it will be stored in the Nginx directory.
 When data is already cached, it need not be fetched from RGW. A permission check will be made against RGW to ensure the requesting user has access.
 This feature is based on some Nginx modules, ngx_http_auth_request_module, https://github.com/kaltura/nginx-aws-auth-module, Openresty for lua capabilities.     
 Currently this feature only works for GET requests and it will cache only AWSv4 requests (only s3 requests).
@@ -34,7 +34,7 @@ Returns success if the encapsulated request would be granted.
 Cache API
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-This API meant to allow changing signed Range headers using a privileged user, cache user.
+This API is meant to allow changing signed Range headers using a privileged user, cache user.
 
 Creating cache user
 
@@ -77,7 +77,7 @@ Compile openresty, Make sure that you have pcre lib and openssl lib:
 ::
 
 $ sudo yum install pcre-devel openssl-devel gcc curl zlib-devel nginx
-$ ./configure --add-module=<the nginx-aws-auth-module dir> --with-http_auth_request_module --with-http_slice_module
+$ ./configure --add-module=<the nginx-aws-auth-module dir> --with-http_auth_request_module --with-http_slice_module --conf-path=/etc/nginx/nginx.conf
 $ gmake -j $(nproc)
 $ sudo gmake install
 $ sudo ln -sf /usr/local/openresty/bin/openresty /usr/bin/nginx
@@ -86,9 +86,27 @@ Put in-place your nginx configuration files and edit them according to your envi
 
 All nginx conf files are under: https://github.com/ceph/ceph/tree/master/examples/rgw-cache 
 
-nginx.conf should go to /etc/nginx/nginx.conf
+nginx.conf should go to /etc/nginx/nginx.conf  
+
 nginx-lua-file.lua should go to /etc/nginx/nginx-lua-file.lua
-nginx-default.conf should go to /etc/nginx/conf.d/nginx-default.conf
+
+nginx-default.conf should go to /etc/nginx/conf.d/nginx-default.conf  
+
+The parameters that are most likely to require adjustment according to the environment are located in the file nginx-default.conf   
+
+Modify the example values of *proxy_cache_path* and *max_size* at:
+
+`proxy_cache_path /data/cache levels=2:2:2 keys_zone=mycache:999m max_size=20G inactive=1d use_temp_path=off;` 
+
+And modify the example *server* values to point to the RGWs URIs: 
+
+`server rgw1:8000 max_fails=2 fail_timeout=5s;`
+
+`server rgw2:8000 max_fails=2 fail_timeout=5s;`
+
+`server rgw3:8000 max_fails=2 fail_timeout=5s;` 
+   
+It is important to substitute the access key and secret key located in the nginx.conf with those belong to the user with the amz-cache caps 
 
 It is possible to use nginx slicing which is a better method for streaming purposes.
 
@@ -106,4 +124,4 @@ Using noprefetch means that if the client is sending range request of 0-4095 and
 Run nginx(openresty):
 ::
 
-$ nginx -c /etc/nginx/nginx.conf
+$ sudo systemctl restart nginx
index 9d49d156868fe8c420919e867c58219f8533d9ee..37dbb8070102420690524f9f7fa27e97356a06f5 100644 (file)
@@ -1,6 +1,6 @@
 #config cache size and path to the cache directory, you should make sure that the user that is running nginx have permissions to access the cache directory
 #max_size means that Nginx will not cache more than 20G, It should be tuned to a larger number if the /data/cache is bigger
-proxy_cache_path /data/cache levels=3:2 keys_zone=mycache:999m max_size=20G inactive=1d use_temp_path=off;
+proxy_cache_path /data/cache levels=2:2:2 keys_zone=mycache:999m max_size=20G inactive=1d use_temp_path=off;
 upstream rgws {
     # List of all rgws (ips or resolvable names)
     server rgw1:8000 max_fails=2 fail_timeout=5s;
index e7ec3350a95a072ecffd992129f16f837bc49171..30661d30033297b78b186501741d64907c29f2be 100644 (file)
@@ -1,6 +1,6 @@
 #config cache size and path to the cache directory, you should make sure that the user that is running nginx have permissions to access the cache directory
 #max_size means that Nginx will not cache more than 20G, It should be tuned to a larger number if the /data/cache is bigger
-proxy_cache_path /data/cache levels=3:2 keys_zone=mycache:999m max_size=20G inactive=1d use_temp_path=off;
+proxy_cache_path /data/cache levels=2:2:2 keys_zone=mycache:999m max_size=20G inactive=1d use_temp_path=off;
 upstream rgws {
     # List of all rgws (ips or resolvable names)
     server rgw1:8000 max_fails=2 fail_timeout=5s;
index d9359ddebf688c4422db8e52b2028c45b6606a83..1d6606d30fd85116f18504b72c3a69caaca53596 100644 (file)
@@ -1,6 +1,6 @@
 #config cache size and path to the cache directory, you should make sure that the user that is running nginx have permissions to access the cache directory
 #max_size means that Nginx will not cache more than 20G, It should be tuned to a larger number if the /data/cache is bigger
-proxy_cache_path /data/cache levels=3:2 keys_zone=mycache:999m max_size=20G inactive=1d use_temp_path=off;
+proxy_cache_path /data/cache levels=2:2:2 keys_zone=mycache:999m max_size=20G inactive=1d use_temp_path=off;
 upstream rgws {
     # List of all rgws (ips or resolvable names)
     server rgw1:8000 max_fails=2 fail_timeout=5s;
index f0938ad0498ce24876c0aae3ef4e742d8387f687..f000597da62e50b62f2fcc76462ae9892134cc87 100644 (file)
@@ -3,7 +3,6 @@ user  nginx;
 #Process per core
 worker_processes  auto;
 pid        /var/run/nginx.pid;
-
 events {
 #Number of connections per worker
     worker_connections  1024;
@@ -11,9 +10,11 @@ events {
 
 
 http {
+    types_hash_max_size 4096;
        lua_package_path '/usr/local/openresty/lualib/?.lua;;'; 
        aws_auth $aws_token {
     # access key and secret key of the cache 
+    # Please substitute with the access key and secret key of the amz-cache cap user
         access_key cache;
         secret_key cache;
         service s3;
@@ -37,4 +38,3 @@ http {
     keepalive_timeout  65;
     include /etc/nginx/conf.d/*.conf;
 }
-