Git Product home page Git Product logo

Comments (13)

longwave avatar longwave commented on July 3, 2024 1

Solr 4.4 through 4.10 have automatic core discovery, for these versions you have to:

  • create a core directory manually containing conf and data
  • manually copy your config into conf (ensure there is no <dataDir> set in solrconfig.xml)
  • place core.properties containing name=[your core name] in the core directory

My Ansible playbook for a Solr 4.8.1 server with 3 cores on an EC2 instance looks like this:

---
- hosts: all
  become: yes
  gather_facts: yes

  roles:
    - geerlingguy.java
    - geerlingguy.solr

  vars:
    solr_version: 4.8.1
    cores:
      - app1
      - app2
      - app3

  tasks:
    - name: Mount EBS volume
      mount:
        name: /mnt/solr
        src: /dev/xvdf
        fstype: ext4
        opts: defaults,nofail
        state: present

    - name: Create Solr core
      lineinfile:
        path: "/var/solr/{{ item }}/core.properties"
        regexp: '^name='
        line: 'name={{ item }}'
        create: yes
        owner: solr
        group: solr
        mode: 0644
      with_items: "{{ cores }}"

    - name: Deploy Solr config
      copy:
        src: "files/{{ item }}/solr/"
        dest: "/var/solr/{{ item }}/conf"
        owner: solr
        group: solr
        mode: 0644
      with_items: "{{ cores }}"

    - name: Symlink Solr data
      file:
        src: "/mnt/solr/{{ item }}"
        dest: "/var/solr/{{ item }}/data"
        force: yes
        owner: solr
        group: solr
        state: link
      with_items: "{{ cores }}"

from ansible-role-solr.

simesy avatar simesy commented on July 3, 2024 1

Ok, solr hadn't started properly. Making more sense now.

from ansible-role-solr.

geerlingguy avatar geerlingguy commented on July 3, 2024

@fubarhouse - Yeah... I've actually been trying to find a nice simple way to do it for one of my own projects too. It was never super easy to add cores in 3.x/4.x, but the basic way I'm doing it now is:

  • use a templated solr.xml file with all the cores listed.
  • manually modify the <dataDir> in each core's solrconfig.xml file
  • copy things into the right places
  • cross fingers and hope it all works!

from ansible-role-solr.

simesy avatar simesy commented on July 3, 2024

Can anyone offer a task file that creates a new core from Drupal's search_api_solr config? I had it working for 5 but struggling a bit with 4 - trying to duplicate the Acquia setup.

from ansible-role-solr.

fubarhouse avatar fubarhouse commented on July 3, 2024

@simesy have you tried the playbook by @longwave?

You'd need a Solr 4 instace for it to work, but it looks good. You may also need to template a file for the cores.

I'll have anotherlook today - I have not had a lot of Solr 6 success in local drupal development in recent weeks.

from ansible-role-solr.

simesy avatar simesy commented on July 3, 2024

Thanks fubarhouse, i'll have a looksee.

from ansible-role-solr.

simesy avatar simesy commented on July 3, 2024

Oh you mean up there. yeah i manually tried those steps that failed, but since then I went on a long loop of other things. Going to try again now.

from ansible-role-solr.

fubarhouse avatar fubarhouse commented on July 3, 2024

I could look into it in that case, the most critical piece is templating a single file with the core configs.

I’ve no problem with templating it, but longer term management isn’t flexible outside of Ansible and as you’ve seen in person our Jenkins workflows capitalise on that flexibility. I haven’t invested in Solr 4 config management yet...

I would use geerlingguy’s recommendation in doing this, but no guarantees though, I’m pressed for time outside work hours at the moment.

Edit: could you provide the output of that playbook? It’s a fantastic starting point!!

from ansible-role-solr.

simesy avatar simesy commented on July 3, 2024

i think the templating thing is fine, it's installing any core and getting anything to show on http.../solr/ :)

from ansible-role-solr.

simesy avatar simesy commented on July 3, 2024

For reference these are my config and rudimentary steps. With:

  • assets/core.properties referenced below containing name=MYCORE
  • drupal-vm config.yml contains config below
  • vagrant up
  • sudo /etc/init.d/solr start
  • then visit MYSITE.vm:8983/solr/#/MYCORE
installed_extras:
 ... ...
  - solr

...

solr_version: "4.5.1"
solr_xms: "64M"
solr_xmx: "128M"
solr_remove_cruft: true
solr_install_path: /opt/solr
solr_connect_host: MYSITE.vm
  - name: Setup Drupal solr config
    copy:
      src: ../docroot/modules/contrib/search_api_solr/solr-conf/4.x/
      dest: /var/solr/MYCORE/conf/
      owner: solr
      group: solr
      mode: 0755
    when: stat_solr.stat.exists == False

  - name: Set discoverable core property file
    template:
      src: assets/core.properties
      dest: "/var/solr/MYCORE/"
      owner: solr
      group: solr
      mode: 0755

Thanks @longwave !

from ansible-role-solr.

simesy avatar simesy commented on July 3, 2024

Something changed which means i don't need to manually start solr, probably 018d78e

from ansible-role-solr.

stale avatar stale commented on July 3, 2024

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

from ansible-role-solr.

stale avatar stale commented on July 3, 2024

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

from ansible-role-solr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.