提交各组件部署Ansible剧本初版
This commit is contained in:
5
Apache Ignite/2.15.0/ignite/hosts
Normal file
5
Apache Ignite/2.15.0/ignite/hosts
Normal file
@@ -0,0 +1,5 @@
|
||||
[zookeeper]
|
||||
192.168.45.102
|
||||
|
||||
[ignite]
|
||||
192.168.45.102
|
||||
7
Apache Ignite/2.15.0/ignite/install.yml
Normal file
7
Apache Ignite/2.15.0/ignite/install.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
- hosts: ignite
|
||||
remote_user: root
|
||||
roles:
|
||||
- role
|
||||
vars_files:
|
||||
- role/vars/main.yml
|
||||
|
||||
12
Apache Ignite/2.15.0/ignite/role/defaults/main.yml
Normal file
12
Apache Ignite/2.15.0/ignite/role/defaults/main.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
#The default installation location
|
||||
deploy_dir: /data/olap
|
||||
|
||||
#The default data storage location,use storing application data,logs and configuration files
|
||||
data_dir: /data/olap
|
||||
|
||||
ignite:
|
||||
#Running memory of the Nacos.
|
||||
java_opt: '-Xmx1024m -Xms1024m'
|
||||
#Setting region max size equal to physical RAM size(5 GB).
|
||||
maxSize: '#{5L * 1024 * 1024 * 1024}'
|
||||
|
||||
25
Apache Ignite/2.15.0/ignite/role/handlers/main.yml
Normal file
25
Apache Ignite/2.15.0/ignite/role/handlers/main.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
- name: Loading Image
|
||||
docker_image:
|
||||
name: '{{ image_name }}'
|
||||
tag: '{{ image_tag }}'
|
||||
load_path: '{{ deploy_dir }}/{{ container_name }}/{{ image_name }}-{{ image_tag }}.tar'
|
||||
source: load
|
||||
force_tag: yes
|
||||
force_source: yes
|
||||
timeout: 300
|
||||
|
||||
- name: Stop Container
|
||||
docker_container:
|
||||
name: '{{ container_name }}'
|
||||
state: absent
|
||||
|
||||
- name: Start Container
|
||||
docker_compose:
|
||||
project_src: '{{ deploy_dir }}/{{ container_name }}/'
|
||||
|
||||
- name: Removing Image
|
||||
docker_image:
|
||||
name: '{{ image_name }}'
|
||||
tag: '{{ image_tag }}'
|
||||
state: absent
|
||||
|
||||
48
Apache Ignite/2.15.0/ignite/role/tasks/deploy.yml
Normal file
48
Apache Ignite/2.15.0/ignite/role/tasks/deploy.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
- block:
|
||||
- name: Check the Zookeeper status
|
||||
shell: netstat -anlp | egrep "2181" | grep LISTEN | wc -l
|
||||
register: port_out
|
||||
delegate_to: "{{ groups.zookeeper[0] }}"
|
||||
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "Port 2181 of the zookeeper node is not monitored. The status may be abnormal"
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
when: port_out.stdout != '1'
|
||||
|
||||
- name: Creating directory
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ deploy_dir }}/{{ container_name }}/{{ item.dir }}'
|
||||
with_items:
|
||||
- { dir: 'config' }
|
||||
|
||||
- name: unpack libs.zip
|
||||
unarchive:
|
||||
src: 'files/libs.zip'
|
||||
dest: '{{ deploy_dir }}/{{ container_name }}/'
|
||||
|
||||
- name: Copying image to {{ deploy_dir }}/{{ container_name }}/
|
||||
copy:
|
||||
src: 'files/{{ image_name }}-{{ image_tag }}.tar'
|
||||
dest: '{{ deploy_dir }}/{{ container_name }}/'
|
||||
force: true
|
||||
notify:
|
||||
- Loading Image
|
||||
|
||||
|
||||
- name: Copying config files
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: 0644
|
||||
with_items:
|
||||
- { src: 'docker-compose.yml.j2', dest: '{{ deploy_dir }}/{{ container_name }}/docker-compose.yml' }
|
||||
- { src: 'default-config.xml.j2', dest: '{{ deploy_dir }}/{{ container_name }}/config/default-config.xml' }
|
||||
notify:
|
||||
- Start Container
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
|
||||
10
Apache Ignite/2.15.0/ignite/role/tasks/main.yml
Normal file
10
Apache Ignite/2.15.0/ignite/role/tasks/main.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- block:
|
||||
- include: uninstall.yml
|
||||
- include: deploy.yml
|
||||
# - include: status-check.yml
|
||||
when: (operation) == "install"
|
||||
|
||||
- block:
|
||||
- include: uninstall.yml
|
||||
when: (operation) == "uninstall"
|
||||
|
||||
17
Apache Ignite/2.15.0/ignite/role/tasks/status-check.yml
Normal file
17
Apache Ignite/2.15.0/ignite/role/tasks/status-check.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
- name: Waitting for Kafka running,60s
|
||||
shell: sleep 60
|
||||
|
||||
- name: Check if the Kafka already exists
|
||||
shell: ps -ef | grep -v grep | grep kafka.Kafka | wc -l
|
||||
register: process_out
|
||||
|
||||
- name: Check if the Kafka already exists
|
||||
shell: netstat -anlp | egrep "9092|9094|9095" | grep LISTEN | wc -l
|
||||
register: port_out
|
||||
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "Kafka on node {{ inventory_hostname }} is not started. Please check"
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
when: process_out.stdout != '1' or port_out.stdout != '3'
|
||||
28
Apache Ignite/2.15.0/ignite/role/tasks/uninstall.yml
Normal file
28
Apache Ignite/2.15.0/ignite/role/tasks/uninstall.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
- block:
|
||||
- name: Stopping and removing {{ container_name }} container
|
||||
docker_container:
|
||||
name: '{{ container_name }}'
|
||||
state: absent
|
||||
|
||||
- name: Removing old {{ image_name }} image
|
||||
docker_image:
|
||||
name: '{{ image_name }}'
|
||||
tag: '{{ image_tag }}'
|
||||
state: absent
|
||||
|
||||
- name: Ansible delete old {{ deploy_dir }}/{{ container_name }}
|
||||
file:
|
||||
path: '{{ deploy_dir }}/{{ container_name }}'
|
||||
state: absent
|
||||
|
||||
- name: Checking ZooKeeper has Ignite nodes
|
||||
shell: "docker exec -it zookeeper zkCli.sh ls / | grep apacheIgnite | wc -l"
|
||||
run_once: true
|
||||
delegate_to: "{{ groups.zookeeper[0] }}"
|
||||
register: has_zknode
|
||||
|
||||
- name: Delete Ignite nodes in ZooKeeper
|
||||
shell: "docker exec -it zookeeper zkCli.sh rmr /apacheIgnite"
|
||||
run_once: true
|
||||
delegate_to: "{{ groups.zookeeper[0] }}"
|
||||
when: has_zknode.stdout >= '1'
|
||||
128
Apache Ignite/2.15.0/ignite/role/templates/default-config.xml.j2
Normal file
128
Apache Ignite/2.15.0/ignite/role/templates/default-config.xml.j2
Normal file
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans
|
||||
xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util
|
||||
http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
|
||||
<property name="cacheConfiguration">
|
||||
<list>
|
||||
<bean abstract="true" class="org.apache.ignite.configuration.CacheConfiguration" id="cache-template-bean">
|
||||
<!-- when you create a template via XML configuration, you must add an asterisk to the name of the template -->
|
||||
<property name="name" value="SanityDirectoryCacheTemplate*"/>
|
||||
<property name="cacheMode" value="PARTITIONED"/>
|
||||
<property name="backups" value="1"/>
|
||||
<property name="onheapCacheEnabled" value="true"/>
|
||||
<property name="rebalanceMode" value="ASYNC"/>
|
||||
<!-- 副本同步模式: -->
|
||||
<!-- PRIMARY_SYNC (默认模式,primary 写成功即可算成功,从backup节点读数据,有可能读到的任然是旧数据) -->
|
||||
<!-- FULL_SYNC (写cache的操作在primary节点和backup节点都成功写入后返回, 保证了写入成功后节点之间的数据都一样) -->
|
||||
<!-- FULL_ASYNC (写cache的操作不用等primary节点和backup节点成功写入即可返回, 读primary节点的数据都有可能读到旧数据) -->
|
||||
<property name="writeSynchronizationMode" value="PRIMARY_SYNC"/>
|
||||
<!-- 分区丢失处理: -->
|
||||
<!-- IGNORE (默认模式,即使出现了partition loss的情况,Ignite会自动忽略并且会清空和partion loss相关的状态不会触发EVT_CACHE_REBALANCE_PART_DATA_LOST 事件) -->
|
||||
<!-- READ_WRITE_ALL (Ignite允许所有的读写操作,就好像partition loss没发生过) -->
|
||||
<!-- READ_WRITE_SAFE (允许对没有丢失的partition的读写操作,但是对已经丢失的partition的读写操作会失败并抛异常) -->
|
||||
<!-- READ_ONLY_ALL (允许对丢失的和正常的partition的读操作,但是写操作会失败并抛异常) -->
|
||||
<!-- READ_ONLY_SAFE (所有的写操作和对丢失partition的读操作都会失败并抛异常。允许对正常的partition的读操作) -->
|
||||
<property name="partitionLossPolicy" value="READ_WRITE_ALL"/>
|
||||
<!-- Other cache parameters -->
|
||||
<!-- Enable statistics for the cache. -->
|
||||
<property name="statisticsEnabled" value="true"/>
|
||||
</bean>
|
||||
</list>
|
||||
</property>
|
||||
<property name="metricsLogFrequency" value="0"/>
|
||||
<!--失败检测 超时时长-->
|
||||
<property name="failureDetectionTimeout" value="#{60 * 60 * 1000}"/>
|
||||
<!-- 服务worker 之间交互 timeout 时间,默认 10s -->
|
||||
<property name="systemWorkerBlockedTimeout" value="#{60 * 60 * 1000}"/>
|
||||
<!-- 服务出现故障自动重启 -->
|
||||
<property name="failureHandler">
|
||||
<bean class="org.apache.ignite.failure.RestartProcessFailureHandler"/>
|
||||
</property>
|
||||
<!-- Set batch size. -->
|
||||
<property name="rebalanceBatchSize" value="#{1 * 1024 * 1024 * 1024}"/>
|
||||
<!-- Set throttle interval. -->
|
||||
<!-- 查询线程池大小 (max(8, total number of cores)) -->
|
||||
<property name="queryThreadPoolSize" value="208"/>
|
||||
|
||||
<property name="rebalanceThrottle" value="100"/>
|
||||
<property name="dataStorageConfiguration">
|
||||
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
|
||||
<!--并发性水平 可由自己实际情况而定 -->
|
||||
<property name="concurrencyLevel" value="10000"/>
|
||||
|
||||
<!-- 设置内存页大小 (getconf PAGESIZE) -->
|
||||
<property name="pageSize" value="#{4 * 1024}"/>
|
||||
<!-- Size of the WAL (Write Ahead Log) segment -->
|
||||
<property name="walSegmentSize" value="#{1024 * 1024 * 1024}"/>
|
||||
<!--In our experience LOG_ONLY is a good compromise between durability and performance.-->
|
||||
<property name="walMode" value="LOG_ONLY"/>
|
||||
<!-- Enable write throttling. -->
|
||||
<property name="writeThrottlingEnabled" value="true"/>
|
||||
<!-- 检查点频率-->
|
||||
<!--Checkpointing frequency which is a minimal interval when the dirty pages will be written to the Persistent Store.-->
|
||||
<property name="checkpointFrequency" value="180000"/>
|
||||
<!-- persistent storage metrics -->
|
||||
<property name="metricsEnabled" value="true"/>
|
||||
<property name="defaultDataRegionConfiguration">
|
||||
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
|
||||
<!-- 100 MB initial size. -->
|
||||
<property name="initialSize" value="#{100L * 1024 * 1024}"/>
|
||||
<!-- Setting region max size equal to physical RAM size(5 GB). -->
|
||||
<property name="maxSize" value="{{ ignite.maxSize }}"/>
|
||||
<property name="checkpointPageBufferSize" value="#{20L *1024* 1024 * 1024L}" />
|
||||
<property name="persistenceEnabled" value="true"/>
|
||||
</bean>
|
||||
</property>
|
||||
<!-- Defining several data regions for different memory regions 持久化数据存储目录 -->
|
||||
<property name="storagePath" value="/persistence/storage" />
|
||||
<property name="walArchivePath" value="/persistence/walArchive" />
|
||||
<property name="walPath" value="/persistence/wal" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="clientConnectorConfiguration">
|
||||
<bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
|
||||
<property name="port" value="10800"/>
|
||||
</bean>
|
||||
</property>
|
||||
<!-- 指标导出器. -->
|
||||
<property name="metricExporterSpi">
|
||||
<list>
|
||||
<bean class="org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi"/>
|
||||
<bean class="org.apache.ignite.spi.metric.log.LogExporterSpi"/>
|
||||
<bean class="org.apache.ignite.spi.metric.opencensus.OpenCensusMetricExporterSpi"/>
|
||||
</list>
|
||||
</property>
|
||||
<!-- 节点发现. -->
|
||||
<property name="discoverySpi">
|
||||
<bean class="org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpi">
|
||||
<property name="zkConnectionString" value="{% for dev_info in groups.zookeeper -%}
|
||||
{% if loop.last -%}
|
||||
{{dev_info}}:2181"/>
|
||||
{%- else %}
|
||||
{{dev_info}}:2181,
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
<property name="sessionTimeout" value="30000"/>
|
||||
<property name="zkRootPath" value="/apacheIgnite"/>
|
||||
<property name="joinTimeout" value="10000"/>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
<!-- 监控配置. -->
|
||||
<bean id="opencensusWrapper" class="org.springframework.beans.factory.config.MethodInvokingBean">
|
||||
<property name="staticMethod" value="io.opencensus.exporter.stats.prometheus.PrometheusStatsCollector.createAndRegister"/>
|
||||
</bean>
|
||||
<bean id="httpServer" class="io.prometheus.client.exporter.HTTPServer">
|
||||
<constructor-arg type="java.lang.String" value="{{ inventory_hostname }}"/>
|
||||
<constructor-arg type="int" value="9916"/>
|
||||
<constructor-arg type="boolean" value="true"/>
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -0,0 +1,26 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
ignite:
|
||||
image: ignite:2.15.0
|
||||
container_name: ignite
|
||||
restart: always
|
||||
ports:
|
||||
- "47103:47100"
|
||||
- "47503:47500"
|
||||
- "49114:49112"
|
||||
- "10800:10800"
|
||||
- "9999:9999"
|
||||
environment:
|
||||
- JVM_OPTS=-server {{ ignite.java_opt }} -XX:+AlwaysPreTouch -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:+DisableExplicitGC -Duser.timezone=UTC
|
||||
- IGNITE_QUIET=false
|
||||
- IGNITE_CONFIG_FILE=/opt/ignite/apache-ignite/config/default-config.xml
|
||||
- IGNITE_WORK_DIR=/persistence
|
||||
- IGNITE_LIBS=/opt/ignite/apache-ignite/libs/*
|
||||
- JAVA_OPTS=-Duser.timezone=Asia/Shanghai
|
||||
- timezone=Asia/Shanghai
|
||||
volumes:
|
||||
- {{ deploy_dir }}/{{ container_name }}/config/default-config.xml:/opt/ignite/apache-ignite/config/default-config.xml:rw
|
||||
- {{ deploy_dir }}/{{ container_name }}/data:/persistence:rw
|
||||
- {{ deploy_dir }}/{{ container_name }}/libs:/opt/ignite/apache-ignite/libs
|
||||
network_mode: "host"
|
||||
BIN
Apache Ignite/2.15.0/ignite/role/vars/.main.yml.swp
Normal file
BIN
Apache Ignite/2.15.0/ignite/role/vars/.main.yml.swp
Normal file
Binary file not shown.
11
Apache Ignite/2.15.0/ignite/role/vars/main.yml
Normal file
11
Apache Ignite/2.15.0/ignite/role/vars/main.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
#镜像名称
|
||||
image_name: ignite
|
||||
|
||||
#镜像版本号
|
||||
image_tag: 2.15.0
|
||||
|
||||
#容器名称
|
||||
container_name: ignite
|
||||
|
||||
#组件版本
|
||||
component_version: ignite-2.15.0
|
||||
Reference in New Issue
Block a user