在AWS上构建3个节点的Ignite群集工作

时间:2019-09-27 16:42:37

标签: ignite

有人成功在AWS上成功启动了三节点点火集群吗?如果可以的话,可以帮助您逐步解决问题的方法。

Ignite文档没有意义,而且没有信息,也没有屏幕快照,该文档只是解释了在一个Ec2上运行的docker实例,但是我至少需要在AWS或EMR上使用三节点点燃集群。

我确实尝试了此博客(https://aws.amazon.com/blogs/big-data/real-time-in-memory-oltp-and-analytics-with-apache-ignite-on-aws/)和云形成json(https://github.com/aws-samples/aws-big-data-blog/blob/master/aws-blog-real-time-in-memory-oltp-and-analytics-with-apache-ignite/cloudformation/configignite.json),以下是configureIgnite.sh脚本,云形成模板引用了该脚本,但是点燃设置失败,并出现属性语法错误在default-config.xml文件中

#!/bin/bash

#
# This is a modified version of the file stored at s3://publicbucketbabupe/ignitelibrary/configureIgnite.sh
# which changes the config to use the instance provided credentials rather than requiring access/secret to be passed in
#
# Parameters are 
# 1 - Cache Name
# 2 - Number of replicas
# 3 - S3 Bucket Name
#

echo "<?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:util=\"http://www.springframework.org/schema/util\"
       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
       http://www.springframework.org/schema/util
       http://www.springframework.org/schema/util/spring-util.xsd\">
    <!--
                          Alter configuration below as needed.
    -->
  <bean id=\"grid.cfg\" class=\"org.apache.ignite.configuration.IgniteConfiguration\">
    <property name=\"cacheConfiguration\">
      <list>
        <bean class=\"org.apache.ignite.configuration.CacheConfiguration\">
          <property name=\"name\" value=\"$1\"/>" > /tmp/igniteconfig.xml

echo "    <property name=\"cacheMode\" value=\"PARTITIONED\"/>
          <property name=\"atomicWriteOrderMode\" value=\"PRIMARY\"/>
          <property name=\"writeSynchronizationMode\" value=\"PRIMARY_SYNC\"/>" >> /tmp/igniteconfig.xml

availfreeMemory=$(cat /proc/meminfo|grep MemTotal|awk '{print $2}')
memoryOverhead=$((availfreeMemory/1024/1024/10))
availfreeMemoryinGB=$((availfreeMemory/1024/1024 - memoryOverhead))
if [[ $availfreeMemoryinGB -gt 8 ]]; then
    offheapmemoryinGB=$((availfreeMemoryinGB-8))
    echo "    <property name=\"memoryMode\" value=\"ONHEAP_TIERED\" />
      <property name=\"offHeapMaxMemory\" value=\"#{$offheapmemoryinGB * 1024L * 1024L * 1024L}\" />" >> /tmp/igniteconfig.xml
    echo "8g" > /tmp/heapsize.log
else
    echo "${availfreeMemoryinGB}g" > /tmp/heapsize.log
fi
echo "    <property name=\"evictionPolicy\">
        <bean class=\"org.apache.ignite.cache.eviction.lru.LruEvictionPolicy\">
            <property name=\"maxSize\" value=\"100000000\"/>
        </bean>
      </property>" >> /tmp/igniteconfig.xml
echo "    <property name=\"swapEnabled\" value=\"false\"/>" >> /tmp/igniteconfig.xml
echo "    <property name=\"atomicityMode\" value=\"ATOMIC\" />" >> /tmp/igniteconfig.xml
echo "    <property name=\"backups\" value=\"$2\" />" >> /tmp/igniteconfig.xml
echo "  </bean>" >> /tmp/igniteconfig.xml
echo " </list>" >> /tmp/igniteconfig.xml
echo "</property>" >> /tmp/igniteconfig.xml
echo "<property name=\"discoverySpi\">
        <bean class=\"org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi\">
          <property name=\"ipFinder\">
            <bean class=\"org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder\">
              <property name=\"awsCredentials\" ref=\"aws.creds\"/>
              <property name=\"bucketName\" value=\"$3\"/>
             </bean>
          </property>
        </bean>
    </property>
    <property name=\"communicationSpi\">
    <bean class=\"org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi\">
      <property name=\"slowClientQueueLimit\" value=\"1000\"/>
    </bean>
  </property>
  </bean>
<!-- AWS credentials. Provide your access key ID and secret access key. -->
<bean id="aws.creds" class="com.amazonaws.auth.BasicAWSCredentials">
  <constructor-arg value="" />
  <constructor-arg value="" />
</bean>

</beans>" >> /tmp/igniteconfig.xml

我还尝试了该博客(https://www.gridgain.com/docs/8.7.6//installation-guide/manual-install-on-ec2中提到的以下步骤),我遇到了Spring XML错误。

下面是我的aws-static-ip-finder.xml文件中的内容。

<bean class="org.apache.ignite.configuration.IgniteConfiguration" >
    <!-- other properties -->
    <!-- Explicitly configure TCP discovery SPI to provide a list of nodes. -->
    <property name="discoverySpi">
        <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
            <property name="ipFinder">
                <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                    <property name="addresses">
                        <list>
                            <value>172.31.81.211</value>
                            <value>172.31.82.21</value>
                        </list>
                    </property>
                </bean>
            </property>
        </bean>
    </property>
</bean>
class org.apache.ignite.IgniteException: Failed to instantiate Spring XML application context [springUrl=file:/home/ec2-user/aws-static-ip-finder_2.xml, err=Line 1 in XML document from URL [file:/home/ec2-user/aws-static-ip-finder_2.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 67; cvc-elt.1: Cannot find the declaration of element 'bean'.]
    at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1052)
    at org.apache.ignite.Ignition.start(Ignition.java:350)
    at org.apache.ignite.startup.cmdline.CommandLineStartup.main(CommandLineStartup.java:300)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to instantiate Spring XML application context [springUrl=file:/home/ec2-user/aws-static-ip-finder_2.xml, err=Line 1 in XML document from URL [file:/home/ec2-user/aws-static-ip-finder_2.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 67; cvc-elt.1: Cannot find the declaration of element 'bean'.]
    at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:391)
    at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:103)
    at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:97)
    at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:750)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:951)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:860)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:730)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:699)
    at org.apache.ignite.Ignition.start(Ignition.java:347)
    ... 1 more
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from URL [file:/home/ec2-user/aws-static-ip-finder_2.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 67; cvc-elt.1: Cannot find the declaration of element 'bean'.
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
    at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:378)
    ... 9 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 67; cvc-elt.1: Cannot find the declaration of element 'bean'.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1901)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:613)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3132)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:852)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
    at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
    ... 12 more
Failed to start grid: Failed to instantiate Spring XML application context [springUrl=file:/home/ec2-user/aws-static-ip-finder_2.xml, err=Line 1 in XML document from URL [file:/home/ec2-user/aws-static-ip-finder_2.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 67; cvc-elt.1: Cannot find the declaration of element 'bean'.]

谢谢 斯里

2 个答案:

答案 0 :(得分:1)

能否请您分享您为使集群形成工作所做的尝试?而您使用的是哪个版本的Ignite?

基本上,您必须在Discovery SPI中创建具有匹配IP查找器的Ignite配置,请查看此文档:

https://apacheignite-mix.readme.io/docs/amazon-aws

您还可以使用包含EC2实例的公共IP地址的简单静态IP Finder:

https://apacheignite.readme.io/docs/tcpip-discovery#section-static-ip-finder

为此,请打开列出的EC2实例,检查“ IPv4 Public IP”字段。

您应该考虑的另一件事是安全组:

https://docs.aws.amazon.com/en_us/vpc/latest/userguide/VPC_SecurityGroups.html#CreatingSecurityGroups

确保以下TCP端口是双向打开的(我已包含默认端口):

发现:47500-47600(静态IP查找程序的端口范围)

通讯:47100-47200

瘦客户端连接端口:10800

REST(可选):8080

请确保这些连接也可以通过“出站”使用,您必须可以接收来自其他EC2实例的消息。

答案 1 :(得分:0)

以下是GridGain的详细文档: https://www.gridgain.com/docs/latest/installation-guide/manual-install-on-ec2

只需用Ignite替换GridGain即可完成部署。