Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having trouble with storing information in memcached #7

Open
cgurjar opened this issue Nov 3, 2014 · 1 comment
Open

Having trouble with storing information in memcached #7

cgurjar opened this issue Nov 3, 2014 · 1 comment

Comments

@cgurjar
Copy link

cgurjar commented Nov 3, 2014

Hi
I am having trouble storing the values into memcache from nginx using the enhanced_memcached_module.

Help me in locating where I am going wrong. I looked at sample nginx.conf but what do you mean by real_host there?

nginx conf located below

user nginx;
worker_processes auto;
worker_rlimit_nofile 100000;

error_log logs/error.log

pid logs/nginx.pid;

events {
worker_connections 19000;
multi_accept on;
use epoll;
}

http {
#Comment below line during performance test because it serves only 3 request per second per IP
limit_req_zone $binary_remote_addr zone=perip:10m rate=3r/s;
#This is to limit Number of request to the upstream servers
#limit_req_zone $server_name zone=perserver:10m rate=5r/s;

    proxy_temp_path /var/tmp;
    include       mime.types;
    default_type  application/json;

    sendfile        on;
    tcp_nopush     on;
    tcp_nodelay on; 
    keepalive_timeout  30;
    keepalive_requests 100000;
    reset_timedout_connection on;
    send_timeout 2;
    gzip_static on;



    #log_format dsl '$time_local -$remote_addr - $request -request_time  -$status';

    upstream memcached_upstream 
    {
        server <My AWS Memcached Server>:11211;
        keepalive 20;
    }

    upstream nodeJSServers
    {
         server 127.0.0.1:8181;
         server 127.0.0.1:8182; 
         server 127.0.0.1:8183;
    }


    server {

                listen    80;
                listen 443  default_server ssl;
                server_name  localhost;
                root /dsl/upload/WorkArea/GitRepo/dce-dataservice/Data-Service/www/JClient/;
                error_page 404 502 = @fallback;

                location /
                    {
                    #I dont need cache here
                      limit_req zone=perip burst=40;          
                      add_header Cache-Control "public, max-age=3600";

                       access_log off;
                           expires 1d;
                    }

                location /products 
                  {
                        #proxy_pass https://localhost/products/;
                        #Comment below line during performance test
                        limit_req zone=perip burst=40;
                        #This line is to serve for number of request per server
                        #limit_req zone=perserver nodelay;

                        access_log off;
                        #access_log logs/out.log dsl buffer=32k;

                        add_header 'Access-Control-Allow-Origin' '*';
                        add_header 'Access-Control-Allow-Credentials' 'true';
                        add_header 'Access-Control-Allow-Headers' 'Content-Type,Accept';
                        add_header 'Access-Control-Allow-Methods' 'GET';    

                        set $enhanced_memcached_key "$request_uri";
                        #memcached_pass schjcecp1261.kj0xhu.cfg.euw1.cache.amazonaws.com:11211;
                        enhanced_memcached_allow_put on;
                        enhanced_memcached_pass memcached_upstream;


                        proxy_redirect off;
                        proxy_set_header   X-Real-IP            $remote_addr;
                        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
                        proxy_set_header   X-Forwarded-Proto $scheme;
                        proxy_set_header   Host                   $http_host;
                        proxy_set_header   X-NginX-Proxy    true;
                        proxy_set_header   Connection "";

                        #proxy_next_upstream     error timeout invalid_header http_500 http_503;
                        proxy_connect_timeout   5;
                        #proxy_pass http://backend_upstream;

                    }
                location @fallback
                    {
                        proxy_pass http://nodeJSServers; 
                    }



            }

}

@bpaquet
Copy link
Owner

bpaquet commented Nov 13, 2014

Can you post the command used to store data ?

Anyway, I think all proxy* directive should be in @fallback section.

Regards,

Bertrand

On Mon, Nov 3, 2014 at 12:39 PM, cgurjar [email protected] wrote:

Hi
I am having trouble storing the values into memcache from nginx using the
enhanced_memcached_module.

Help me in locating where I am going wrong. I looked at sample nginx.conf
but what do you mean by real_host there?
nginx conf located below

user nginx;
worker_processes auto;
worker_rlimit_nofile 100000;

#error_log logs/error.log

pid logs/nginx.pid;

events {
worker_connections 19000;
multi_accept on;
use epoll;
}

http {
#Comment below line during performance test because it serves only 3
request per second per IP
limit_req_zone $binary_remote_addr zone=perip:10m rate=3r/s;
#This is to limit Number of request to the upstream servers
#limit_req_zone $server_name zone=perserver:10m rate=5r/s;

proxy_temp_path /var/tmp;
include       mime.types;
default_type  application/json;

sendfile        on;
tcp_nopush     on;
tcp_nodelay on;
keepalive_timeout  30;
keepalive_requests 100000;
reset_timedout_connection on;
send_timeout 2;
gzip_static on;



#log_format dsl '$time_local -$remote_addr - $request -request_time  -$status';

upstream memcached_upstream
{
    server <My AWS Memcached Server>:11211;
    keepalive 20;
}

upstream nodeJSServers
{
     server 127.0.0.1:8181;
     server 127.0.0.1:8182;
     server 127.0.0.1:8183;
}


server {

            listen    80;
            listen 443  default_server ssl;
            server_name  localhost;
            root /dsl/upload/WorkArea/GitRepo/dce-dataservice/Data-Service/www/JClient/;
            error_page 404 502 = @fallback;

            location /
                {
                #I dont need cache here
                  limit_req zone=perip burst=40;
                  add_header Cache-Control "public, max-age=3600";

                   access_log off;
                       expires 1d;
                }

            location /products
              {
                    #proxy_pass https://localhost/products/;
                    #Comment below line during performance test
                    limit_req zone=perip burst=40;
                    #This line is to serve for number of request per server
                    #limit_req zone=perserver nodelay;

                    access_log off;
                    #access_log logs/out.log dsl buffer=32k;

                    add_header 'Access-Control-Allow-Origin' '*';
                    add_header 'Access-Control-Allow-Credentials' 'true';
                    add_header 'Access-Control-Allow-Headers' 'Content-Type,Accept';
                    add_header 'Access-Control-Allow-Methods' 'GET';

                    set $enhanced_memcached_key "$request_uri";
                    #memcached_pass schjcecp1261.kj0xhu.cfg.euw1.cache.amazonaws.com:11211;
                    enhanced_memcached_allow_put on;
                    enhanced_memcached_pass memcached_upstream;


                    proxy_redirect off;
                    proxy_set_header   X-Real-IP            $remote_addr;
                    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
                    proxy_set_header   X-Forwarded-Proto $scheme;
                    proxy_set_header   Host                   $http_host;
                    proxy_set_header   X-NginX-Proxy    true;
                    proxy_set_header   Connection "";

                    #proxy_next_upstream     error timeout invalid_header http_500 http_503;
                    proxy_connect_timeout   5;
                    #proxy_pass http://backend_upstream;

                }
            location @fallback
                {
                    proxy_pass http://nodeJSServers;
                }



        }

}


Reply to this email directly or view it on GitHub
#7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants