forked from ISTI-ansible-roles/ansible-roles
Role that configures solr cores into a already deployed solr 4.x instance.
This commit is contained in:
parent
9ef7736f10
commit
222ca74268
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
solr_http_port: 8983
|
||||
tomcat_load_additional_default_conf: True
|
||||
tomcat_version: 7
|
||||
# solr needs a lot of time to start if it needs to rebuild its indices
|
||||
tomcat_restart_timeout: 100000
|
||||
|
||||
solr_service: -solr
|
||||
solr_config_name: hindex
|
||||
solr_shards: 1
|
||||
solr_instance: '{{ solr_service }}'
|
||||
solr_log_level: INFO
|
||||
solr_http_port_1: '{{ solr_http_port }}'
|
||||
solr_zoo_port: 9983
|
||||
solr_zoo_port_1: 9984
|
||||
solr_zoo_port_2: 9985
|
||||
solr_jmx_port_1: 8601
|
||||
solr_user: '{{ tomcat_user }}'
|
||||
solr_group: '{{ tomcat_user }}'
|
||||
solr_outside_tomcat_dir: False
|
||||
# We need to define this one because we are using the tomcat multiple instances role
|
||||
solr_tomcat_instance_dir: '{{ tomcat_m_instances_base_path }}/{{ solr_http_port }}'
|
||||
solr_data_dir: '{{ solr_tomcat_instance_dir }}/solr'
|
||||
solr_collections_base_dir: '{{ solr_data_dir }}/data/solr'
|
||||
solr_zookeeper_data_dir: '{{ solr_data_dir }}/zoo_data'
|
||||
solr_install_collection1: False
|
||||
|
||||
# Define the following if you want a multicore installation
|
||||
solr_multicore: False
|
||||
solr_global_cores:
|
||||
- collection1
|
||||
|
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- name: tomcat solr restart
|
||||
service: name=tomcat-instance-{{ solr_http_port }} state=restarted sleep=20
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
- block:
|
||||
- name: Create the solr cores data directories
|
||||
file: dest={{ solr_collections_base_dir }}/{{ item }} state=directory owner={{ solr_user }} group={{ solr_user }}
|
||||
with_items: '{{ solr_cores }}'
|
||||
|
||||
- name: Install the solr cores data on a multicore system
|
||||
unarchive: src={{ solr_data_dir }}/collection_data/solr_core_base.tar.gz dest={{ solr_data_dir }}/data/solr/{{ item }} copy=no
|
||||
args:
|
||||
creates: '{{ solr_data_dir }}/data/solr/{{ item }}/conf/solrconfig.xml'
|
||||
with_items: '{{ solr_global_cores }}'
|
||||
notify: tomcat solr restart
|
||||
|
||||
- name: Install the solr.xml file
|
||||
template: src={{ item }}.j2 dest={{ solr_data_dir }}/data/solr/{{ item }} owner=root group={{ solr_user }} mode=0440
|
||||
with_items:
|
||||
- solr.xml
|
||||
notify: tomcat solr restart
|
||||
|
||||
- name: Fix the cores permissions
|
||||
file: path={{ solr_collections_base_dir }} owner={{ solr_user }} group={{ solr_user }} recurse=yes
|
||||
|
||||
when: solr_multicore is defined and solr_multicore
|
||||
tags: [ solr, tomcat, solr_core ]
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!--
|
||||
This is an example of a simple "solr.xml" file for configuring one or
|
||||
more Solr Cores, as well as allowing Cores to be added, removed, and
|
||||
reloaded via HTTP requests.
|
||||
|
||||
More information about options available in this configuration file,
|
||||
and Solr Core administration can be found online:
|
||||
http://wiki.apache.org/solr/CoreAdmin
|
||||
-->
|
||||
|
||||
<solr>
|
||||
|
||||
<solrcloud>
|
||||
{% if not solr_multicore %}
|
||||
<str name="host">{{ ansible_fqdn }}</str>
|
||||
<int name="hostPort">{{ solr_http_port_1 }}</int>
|
||||
<str name="hostContext">${hostContext:solr}</str>
|
||||
<int name="zkClientTimeout">${zkClientTimeout:30000}</int>
|
||||
<bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
|
||||
{% endif %}
|
||||
</solrcloud>
|
||||
|
||||
<shardHandlerFactory name="shardHandlerFactory" class="HttpShardHandlerFactory">
|
||||
<int name="socketTimeout">${socketTimeout:0}</int>
|
||||
<int name="connTimeout">${connTimeout:0}</int>
|
||||
</shardHandlerFactory>
|
||||
|
||||
{% if solr_multicore %}
|
||||
<cores adminPath="/admin/cores">
|
||||
{% for core in solr_global_cores %}
|
||||
|
||||
<core name="{{ core }}" instanceDir="{{ core }}">
|
||||
<property name="dataDir" value="{{ solr_collections_base_dir }}/{{ core }}" />
|
||||
</core>
|
||||
|
||||
{% endfor %}
|
||||
</cores>
|
||||
{% endif %}
|
||||
|
||||
|
||||
</solr>
|
Loading…
Reference in New Issue