Ignite Cluster 구축해보자!

Karim·2021년 11월 24일
3

Ignite 운영

목록 보기
5/7
post-thumbnail

1. Version

💬

  • OS : CentOS Linux release 7.8.2003(Core)
  • Ignite : 2.11.0
  • Docker : 19.03.13

2. 설치 전 확인사항

💬

  • 작성자는 docekr로 ignite를 올렸다~
  • ignite로 Persistence가 적용된 xml를 잡고 올리는 방법을 아래 링크에 들어가면 있다.!!

🔖 ignite docker로 설치

3. Cluster config-file.xml 옵션 적용

💬 default-config.xml 파일에 적용

  • config 위치로 가서 default-config.xml 파일에 적용한다.
<?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. -->

<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd">
    <!-- Alter configuration below as needed. -->

    <bean
        id="ignite.cfg"
        class="org.apache.ignite.configuration.IgniteConfiguration">

        <!-- 설명 : persistenceEnabled 사용 여부 -->
        <property name="dataStorageConfiguration">
            <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
                <property name="defaultDataRegionConfiguration">
                    <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                        <property name="persistenceEnabled" value="true"/>
                    </bean>
                </property>
            </bean>
        </property>

        <!-- 설명 : cluster일 시 cache 모드 -->
        <property name="cacheConfiguration">
            <list>
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="asset-mapper-cache"/>
                    <property name="cacheMode" value="PARTITIONED"/>
                </bean>
            </list>
        </property>

        <!-- 설명 : cluster일 시 노드들간의 설정 정보 연결 포트 설정 -->
        <property name="connectorConfiguration">
            <bean class="org.apache.ignite.configuration.ConnectorConfiguration">
                <property name="port" value="11211"/>
            </bean>
        </property>

        <!-- 설명 : cluster일 시 노드들간의 통신 포트 설정 -->
        <property name="communicationSpi">
            <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
                <property name="localPort" value="34445"/>
            </bean>
        </property>

        <!-- 설명 : cluster일 시 node간 ip및 port 설정 -->
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <!--cluster일 경우 port를 맞춰줘야 한다.-->
                <property name="localPort" value="34446"/>
                <property name="ipFinder">
                    <bean
                        class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses">
                            <list>
                                <value>127.0.0.1:34446</value>
                                <value>node2:34446</value>
                                <value>node3:34446</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>

4. docker ignite 설치 및 실행

💬 ignite image docker run

docker run -d --name ignite-cluster -v ignite-cluster-volume:/storage -e IGNITE_WORK_DIR=/storage -e CONFIG_URI=/storage/config-file.xml --net=host apacheignite/ignite:2.11.0

5. ignite cluster mode true

💬 cluster mode active

  • control.sh 파일이 있는 bin dir로 이동한다.
  • control.sh --activate 명령어를 실행한다.
bash-4.4# ./control.sh --activate
Control utility [ver. 2.11.0#20210911-sha1:8f3f07d3]
2021 Copyright(C) Apache Software Foundation
User: root
Time: 2022-01-03T02:07:15.584
Command [ACTIVATE] started
Arguments: --activate
--------------------------------------------------------------------------------
Command deprecated. Use --set-state instead.
Cluster activated
Command [ACTIVATE] finished with code: 0
Control utility has completed execution at: 2022-01-03T02:07:16.135
Execution time: 551 ms

6. ignite cluster 확인

💬 cluster mode info

  • control.sh 파일이 있는 bin dir로 이동한다.
  • control.sh --baseline 명령어를 실행한다.
  • 3개가 묶여 있는 것을 확인할 수 있다.
bash-4.4# ./control.sh --baseline
Control utility [ver. 2.11.0#20210911-sha1:8f3f07d3]
2021 Copyright(C) Apache Software Foundation
User: root
Time: 2022-01-04T01:26:56.072
Command [BASELINE] started
Arguments: --baseline
--------------------------------------------------------------------------------
Cluster state: active
Current topology version: 3
Baseline auto adjustment disabled: softTimeout=300000

Current topology version: 3 (Coordinator: ConsistentId=919553d2-3a5d-4667-a33e-e25fbf71e58a, Address=172.17.0.1, Order=1)

Baseline nodes:
    ConsistentId=0705467e-c396-4af3-a6dc-c682187e1478, Address=172.39.0.1, State=ONLINE, Order=3
    ConsistentId=1523dc94-700e-4016-aa2c-a59eb7d75ac9, Address=172.17.0.1, State=ONLINE, Order=2
    ConsistentId=919553d2-3a5d-4667-a33e-e25fbf71e58a, Address=172.17.0.1, State=ONLINE, Order=1
--------------------------------------------------------------------------------
Number of baseline nodes: 3

Other nodes not found.
Command [BASELINE] finished with code: 0
Control utility has completed execution at: 2022-01-04T01:26:57.315
Execution time: 1243 ms

7. cacheMode = "REPLICATE"일 시 베이스라인 토폴로지 활성화

💬 --baseline set

  • control.sh 파일이 있는 bin dir로 이동한다.
  • control.sh --baseline set 명령어를 실행한다.
  • ConsistentId1에 --baseline 명령어에서 나온 node의 uuid를 적는다.

    ./control.sh --baseline set ConsistentId1,ConsistentId2,ConsistentId3

bash-4.4# ./control.sh --baseline set 0a52df82-6b3b-42ab-87bc-1a92353d0bce,5b6f0965-a991-44b9-90c8-b8cde4079dac,87f64d4e-752d-475b-a67b-f79508c63caf
Warning: the command will perform changes in baseline.
Press 'y' to continue . . . y
Control utility [ver. 2.11.0#20210911-sha1:8f3f07d3]
2021 Copyright(C) Apache Software Foundation
User: root
Time: 2022-01-04T09:05:57.406
Command [BASELINE] started
Arguments: --baseline set 0a52df82-6b3b-42ab-87bc-1a92353d0bce,5b6f0965-a991-44b9-90c8-b8cde4079dac,87f64d4e-752d-475b-a67b-f79508c63caf
--------------------------------------------------------------------------------
Cluster state: active
Current topology version: 5
Baseline auto adjustment disabled: softTimeout=300000

Current topology version: 5 (Coordinator: ConsistentId=5b6f0965-a991-44b9-90c8-b8cde4079dac, Address=172.39.0.1, Order=1)

Baseline nodes:
    ConsistentId=0a52df82-6b3b-42ab-87bc-1a92353d0bce, Address=172.17.0.1, State=ONLINE, Order=3
    ConsistentId=5b6f0965-a991-44b9-90c8-b8cde4079dac, Address=172.39.0.1, State=ONLINE, Order=1
    ConsistentId=87f64d4e-752d-475b-a67b-f79508c63caf, Address=172.17.0.1, State=ONLINE, Order=5
--------------------------------------------------------------------------------
Number of baseline nodes: 3

Other nodes not found.
Command [BASELINE] finished with code: 0
Control utility has completed execution at: 2022-01-04T09:06:01.336
Execution time: 3930 ms


📚 참고

profile
나도 보기 위해 정리해 놓은 벨로그

0개의 댓글