You can easily install Indexima on a cluster of machines with our official Ansible Role.
In order to use Ansible, you will need a few things.
For the sake of this guide, let's assume your infrastructure is as follow:
- Ansible machine
- Indexima primary master
- Indexima secondary master 1
- Indexima secondary master 2
The Ansible machine needs to have access to all 3 Indexima nodes on port 22.
Ideally, it also needs to have access to ports 8082, 9999, 10000 to do a connectivity check at the end of the installation.
On the Indexima machines, the ansible user you will use to connect to SSH will need to have sudo privileges and be able to become root.
Install Ansible on the "Ansible Machine"
You can use your local machine or any Linux VM on which you have sudo access.
You can install Ansible following the official instructions here: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html
In order to easily perform all the following operations, it is recommended that the Ansible Machine has internet access to the following sites:
- https://github.com/indexima-dev/ansible-indexima-install (Ansible playbook repository)
- https://download.indexima.com/release/ ( indexima installation file repository)
Clone Indexima role
Start by cloning the Indexima Ansible role
git clone https://github.com/indexima-dev/ansible-indexima-install.git
Prepare the playbook
In order to use Ansible, you need to provide a hosts file, in the .ini format.
You can find an example of a hosts file in the examples folder. Copy it to the root directory
cp examples/hosts.local ./hosts
Then you need to create your machine groups.
Below the "[indexima]" line, there is a line that looks like: node1 ansible_host=localhost is_master=1
Delete it, and write three more lines like this:
node1 ansible_host=<primary_master_ip> is_master=1
node2 ansible_host=<secondary_master_1_ip> is_master=0
node3 ansible_host=<secondary_master_2_ip> is_master=0
Then there are a few variables that you need to customize to make it work
|The UNIX user of the Indexima machine to connect to SSH to
|If you are hosting Indexima on an Amazon Linux machine, ansible_user=ec2-user
|Path to the private key used to connect to the Indexima machines
Define whether or not Ansible uses SSH to connect to the machine.
Set to local if you want to install on the same machine as the Ansible node
|In our example, comment this line
After connecting with the ansible_user, the Indexima install role will become a service user
The ansible_user will need to have sudo privilege in order to become root or any other service
If you are hosting Indexima on an Amazon Linux machine, service_user=ec2-user
This will install Indexima as the same user as the ansible_user
|The number of Indexima nodes in your cluster
|The Indexima version you want to install
You can then write your playbook.
You can find an example in the tests folder
cp tests/test.yml ./indexima.yml
Execute the playbook
To do a full install, execute this command
ansible-playbook -i hosts indexima.yml
To execute only a small part of the playbook, you can use tags.
Here are the most useful ones:
|Install only the Indexima prerequisites: Java8, Hadoop libs, and setting env variables and ulimit
|ansible-playbook -i hosts indexima.yml -t 'prerequisites'
|Install the prerequisites and Indexima, without deploying the configuration
|ansible-playbook -i hosts indexima.yml -t 'install'
|Install Indexima only, without the prerequisites, without deploying the configuration
|ansible-playbook -i hosts indexima.yml -t 'update'
|Deploy the configuration to all Indexima nodes
|ansible-playbook -i hosts indexima.yml -t 'conf'
|ansible-playbook -i hosts indexima.yml -t 'start'
|ansible-playbook -i hosts indexima.yml -t 'stop'
|Completely stop Indexima, Indexima web UI, and then restart it all
|ansible-playbook -i hosts indexima.yml -t 'irestart'
You can also combine tags. For example, if you want to redeploy the configuration and restart the cluster, you can do so with the command:
ansible-playbook -i hosts indexima.yml -t 'conf,restart'