Solr6 Behind NgInx

cancel
Showing results for 
Search instead for 
Did you mean: 
rstoops
Customer

Solr6 Behind NgInx

Hi guys,

I'm attempting to work with a docker-compose file to put 2 solr6s behind it.

I've added another NgInx to the compose file for the purposes of load balancing the solrs. Everything starts but looking at the admin console, it is not showing Tracking status for solr.

I'm looking to see if someone has an example of this.  My nginx.conf file for solr looks as follows:

worker_processes  1;

events { 
    worker_connections 1024; 
}

http {
    upstream solrlb {
        server solr6-1:8084;
    }

    server {
        listen *:8983;
        server_name solrlb;

        location / {
            proxy_pass http://solrlb;
            proxy_set_header Host $host;
            #proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
    }
}

My section for solr in the compose file (3.7 level)

    solr6-1:
        image: alfresco/alfresco-search-services:1.4.2
        deploy:
            resources:
                limits:
                    memory: 2048M
                reservations:
                    memory: 2048M
        environment:
            #Solr needs to know how to register itself with Alfresco
            - SOLR_ALFRESCO_HOST=alfresco
            - SOLR_ALFRESCO_PORT=8080
            #Alfresco needs to know how to call solr
            - SOLR_SOLR_HOST=solr6-1
            - SOLR_SOLR_PORT=8983
            #Create the default alfresco and archive cores
            - SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
            #HTTP by default
            - ALFRESCO_SECURE_COMMS=none
            - "SOLR_JAVA_MEM=-Xms2g -Xmx2g"
        ports:
            - 8084:8983 #Browser port

    solr-balancer:
        image: alfresco/alfresco-acs-nginx:3.0.1
        deploy:
            resources:
                limits:
                    memory: 128M
                reservations:
                    memory: 128M
        depends_on:
            - solr6-1
        ports:
            - 8983:8983
        volumes:
            - type: bind  
              source: /Users/rstoops/dev/projects/alfresco6_docker_compose/solr-nginx.conf
              target: /etc/nginx/nginx.conf

Thanks in advance.

 

6 Replies
angelborroy
Alfresco Employee

Re: Solr6 Behind NgInx

You can use https://github.com/Alfresco/alfresco-docker-installer as reference.

Hyland Developer Evangelist
rstoops
Customer

Re: Solr6 Behind NgInx

Thanks Angel.  I ran the utility and even though solr is behind nginx my goal is to have multiple solr6 which is why I was heading do the path of nginx "upstream" to add a 2nd solr box once I got the first one working.

Can you help with or another resource for this problem?

Thanks again.

Rich

 

rstoops
Customer

Re: Solr6 Behind NgInx

Angel,

Disregard, I've got it configured.

EddieMay
Community Manager
Community Manager

Re: Solr6 Behind NgInx

Hi @rstoops 

Great news! If you have time to update us on how you resolved it that would be great too!

Best wishes,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
rstoops
Customer

Re: Solr6 Behind NgInx

This is what is working for the moment but I need to do more testing.

Section from docker-compose.yml

    solr6-1:
        image: alfresco/alfresco-search-services:1.4.2
        deploy:
            resources:
                limits:
                    memory: 2048M
                reservations:
                    memory: 2048M
        environment:
            #Solr needs to know how to register itself with Alfresco
            - SOLR_ALFRESCO_HOST=alfresco
            - SOLR_ALFRESCO_PORT=8080
            #Alfresco needs to know how to call solr
            - SOLR_SOLR_HOST=solr6-1
            - SOLR_SOLR_PORT=8985
            - SOLR_PORT=8085
            #Create the default alfresco and archive cores
            - SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
            #HTTP by default
            - ALFRESCO_SECURE_COMMS=none
            - "SOLR_JAVA_MEM=-Xms2g -Xmx2g"
        ports:
            - 8985:8085 #Browser port
        volumes: 
            - type: bind
              source: /Users/rstoops/dev/docker/solrdata/data1/data
              target: /opt/alfresco-search-services/data

    solr6-2:
        image: alfresco/alfresco-search-services:1.4.2
        deploy:
            resources:
                limits:
                    memory: 2048M
                reservations:
                    memory: 2048M
        environment:
            #Solr needs to know how to register itself with Alfresco
            - SOLR_ALFRESCO_HOST=alfresco
            - SOLR_ALFRESCO_PORT=8080
            #Alfresco needs to know how to call solr
            - SOLR_SOLR_HOST=solr6-2
            - SOLR_SOLR_PORT=8986
            - SOLR_PORT=8086
            #Create the default alfresco and archive cores
            - SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
            #HTTP by default
            - ALFRESCO_SECURE_COMMS=none
            - "SOLR_JAVA_MEM=-Xms2g -Xmx2g"
        ports:
            - 8986:8086 #Browser port
        volumes: 
            - type: bind
              source: /Users/rstoops/dev/docker/solrdata/data2/data
              target: /opt/alfresco-search-services/data
            
    solr-lb:
        image: alfresco/alfresco-acs-nginx:3.0.1
        deploy:
            resources:
                limits:
                    memory: 128M
                reservations:
                    memory: 128M
        depends_on:
            - solr6-1
            - solr6-2
        ports:
            - 8983:8983
        volumes:
            - type: bind  
              source: /Users/rstoops/dev/projects/alfresco6_docker_compose/solr-nginx.conf
              target: /etc/nginx/nginx.conf
        

 

solr-nginx.conf

worker_processes  1;

events { 
    worker_connections 1024; 
}

http {
    upstream solr-lb {
        server solr6-1:8085;
        server solr6-2:8086;
    }

    server {
        listen *:8983;

        location / {
            proxy_pass http://solr-lb;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }
}

 

 

 

EddieMay
Community Manager
Community Manager

Re: Solr6 Behind NgInx

@rstoops 

Thanks for taking the time to report your approach - reeally great effort!

Cheers,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!