Instalar Apache ignite
1.- Desgargar jdk 1.8 y descromprimir en /opt/jdk/
-
mkdir /opt/jdk/ cd /opt/jdk/ wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz tar xzf jdk-8u171-linux-x64.tar.gz
2.- Definir lasvariables JAVA_HOME y JRE_HOME en /etc/profile
JAVA_HOME=/opt/jdk/jdk1.8.0_171 export JAVA_HOME JRE_HOME=/opt/jdk/jdk1.8.0_171/jre export JRE_HOME
3.- Crear el usuario ignite
useradd ignite passwd ignite
4.-Modificar límites uso de recursos para el usuario ignite. Agregar en /etc/security/limits.conf
ignite - memlock unlimited ignite - nofile 100000 ignite - nproc 32768
5.- Descargar apache ignite y descomprimir en en home del usuario ignite:
su - ignite pwd wget http://www-us.apache.org/dist//ignite/2.6.0/apache-ignite-fabric-2.6.0-bin.zip unzip apache-ignite-fabric-2.6.0-bin.zip
6.- Crear un enlace de /home/ignite/apache-ignite-fabric-2.6.0-bin a /home/ignite/ignite
ln -s /home/ignite/apache-ignite-fabric-2.6.0-bin /home/ignite/ignite
7.- Declarar la variable IGNITE_HOME y modificar la variable PATH en /home/ignite/.bashrc
IGNITE_HOME=/home/ignite/ignite export IGNITE_HOME PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ignite/ignite/bin export PATH
8.- Importar la variable IGNITE_HOME y las variable PATH:
source /home/ignite/.bashrc
9.- Verificar las variables
echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ignite/.local/bin:/home/ignite/bin
env | grep HOME IGNITE_HOME=/home/ignite/ignite JRE_HOME=/opt/jdk/jdk1.8.0_171/jre JAVA_HOME=/opt/jdk/jdk1.8.0_171 HOME=/home/ignite
10.- Iniciar el primer nodo del cluster. Usar el script ingnite.sh
[ignite@usve261279 ~]$ ignite.sh [16:16:59] __________ ________________ [16:16:59] / _/ ___/ |/ / _/_ __/ __/ [16:16:59] _/ // (7 7 // / / / / _/ [16:16:59] /___/\___/_/|_/___/ /_/ /___/ [16:16:59] [16:16:59] ver. 2.6.0#20180710-sha1:669feacc [16:16:59] 2018 Copyright(C) Apache Software Foundation [16:16:59] [16:16:59] Ignite documentation: http://ignite.apache.org [16:16:59] [16:16:59] Quiet mode. [16:16:59] ^-- Logging to file '/home/ignite/ignite/work/log/ignite-c92da959.0.log' [16:16:59] ^-- Logging by 'JavaLogger [quiet=true, config=null]' [16:16:59] ^-- To see **FULL** console log here add -DIGNITE_QUIET=false or "-v" to ignite.{sh|bat} [16:16:59] [16:16:59] OS: Linux 3.10.0-042stab127.2 amd64 [16:16:59] VM information: Java(TM) SE Runtime Environment 1.8.0_171-b11 Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.171-b11 [16:17:00] Configured plugins: [16:17:00] ^-- None [16:17:00] [16:17:00] Configured failure handler: [hnd=StopNodeOrHaltFailureHandler [tryStop=false, timeout=0]] [16:17:00] Message queue limit is set to 0 which may lead to potential OOMEs when running cache operations in FULL_ASYNC or PRIMARY_SYNC modes due to message queues growth on sender and receiver sides. [16:17:00] Security status [authentication=off, tls/ssl=off] [16:17:02] Nodes started on local machine require more than 20% of physical RAM what can lead to significant slowdown due to swapping (please decrease JVM heap size, data region size or checkpoint buffer size) [required=1900MB, available=4096MB] [16:17:03] Performance suggestions for grid (fix if possible) [16:17:03] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true [16:17:03] ^-- Enable G1 Garbage Collector (add '-XX:+UseG1GC' to JVM options) [16:17:03] ^-- Set max direct memory size if getting 'OOME: Direct buffer memory' (add '-XX:MaxDirectMemorySize=<size>[g|G|m|M|k|K]' to JVM options) [16:17:03] ^-- Disable processing of calls to System.gc() (add '-XX:+DisableExplicitGC' to JVM options) [16:17:03] ^-- Speed up flushing of dirty pages by OS (alter vm.dirty_expire_centisecs parameter by setting to 500) [16:17:03] ^-- Reduce pages swapping ratio (set vm.swappiness=10) [16:17:03] ^-- Avoid direct reclaim and page allocation failures (set vm.extra_free_kbytes=1240000) [16:17:03] Refer to this page for more performance suggestions: https://apacheignite.readme.io/docs/jvm-and-system-tuning [16:17:03] [16:17:03] To start Console Management & Monitoring run ignitevisorcmd.{sh|bat} [16:17:03] [16:17:03] Ignite node started OK (id=c92da959) [16:17:03] Topology snapshot [ver=1, servers=1, clients=0, CPUs=2, offheap=0.8GB, heap=1.0GB] [16:17:03] ^-- Node [id=C92DA959-D02D-43A2-9E59-7AAB978A4737, clusterState=ACTIVE] [16:17:03] Data Regions Configured: [16:17:03] ^-- default [initSize=256.0 MiB, maxSize=819.2 MiB, persistenceEnabled=false]
11.- En otra consola, conectartse al cluster con el cliente SQLline :
sqlline.sh –verbose=true -u jdbc:ignite:thin://127.0.0.1/
[ignite@usve261279 ~]$ sqlline.sh --verbose=true -u jdbc:ignite:thin://127.0.0.1/ issuing: !connect jdbc:ignite:thin://127.0.0.1/ '' '' org.apache.ignite.IgniteJdbcThinDriver Connecting to jdbc:ignite:thin://127.0.0.1/ Connected to: Apache Ignite (version 2.6.0#20180710-sha1:669feacc) Driver: Apache Ignite Thin JDBC Driver (version 2.6.0#20180710-sha1:669feacc) Autocommit status: true Transaction isolation: TRANSACTION_REPEATABLE_READ sqlline version 1.3.0 0: jdbc:ignite:thin://127.0.0.1/> 0: jdbc:ignite:thin://127.0.0.1/>
Ejemplos:
Create una tabla
0: jdbc:ignite:thin://127.0.0.1/> CREATE TABLE City ( id LONG PRIMARY KEY, name VARCHAR) WITH "template=replicated"; No rows affected (0.519 seconds)
Listar la tablas, !tables:
0: jdbc:ignite:thin://127.0.0.1/> !tables +--------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-+ | TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | | +--------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-+ | | PUBLIC | CIUDAD | TABLE | | | +--------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-+ 0: jdbc:ignite:thin://127.0.0.1/>
Salir de sesión sqlline con !quit
0: jdbc:ignite:thin://127.0.0.1/> !quit Closing: org.apache.ignite.internal.jdbc.thin.JdbcThinConnection
Para más información visita:
https://apacheignite-sql.readme.io/docs/getting-started