繁体   English   中英

点燃文件系统:集群组为空

[英]ignite filesystem : cluster group is empty

我是Apache Ignite的新手,正在尝试使用FileSystem功能。

当我使用XML配置文件时,一切正常,但是将conf转换为JAVA时,出现此错误:

Exception in thread "main" class org.apache.ignite.igfs.IgfsException: Failed to execute operation because there are no IGFS metadata nodes.
    at org.apache.ignite.internal.processors.igfs.IgfsMetaManager.runClientTask(IgfsMetaManager.java:254)
    at org.apache.ignite.internal.processors.igfs.IgfsImpl.mkdirs(IgfsImpl.java:757)
    at org.apache.ignite.internal.processors.igfs.IgfsImpl.mkdirs(IgfsImpl.java:749)
    at com.test.IgniteCacheClass.main(IgniteCacheClass.java:171)
Caused by: class org.apache.ignite.cluster.ClusterGroupEmptyException: Cluster group is empty.
    at org.apache.ignite.internal.util.IgniteUtils$5.apply(IgniteUtils.java:765)
    at org.apache.ignite.internal.util.IgniteUtils$5.apply(IgniteUtils.java:763)
    at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:903)
    at org.apache.ignite.internal.IgniteComputeImpl.call(IgniteComputeImpl.java:355)
    at org.apache.ignite.internal.processors.igfs.IgfsMetaManager.runClientTask(IgfsMetaManager.java:251)
    ... 3 more
Caused by: class org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException: Cluster group is empty.
    at org.apache.ignite.internal.util.IgniteUtils.emptyTopologyException(IgniteUtils.java:4621)
    at org.apache.ignite.internal.processors.closure.GridClosureProcessor.callAsync(GridClosureProcessor.java:584)
    at org.apache.ignite.internal.processors.closure.GridClosureProcessor.callAsync(GridClosureProcessor.java:428)
    at org.apache.ignite.internal.IgniteComputeImpl.call(IgniteComputeImpl.java:352)
    ... 4 more

我在写作时找到了解决方案,但是还有另一个问题。 它不起作用是因为我以客户端模式启动了(显然是……)。 但是在使用XML且未显式设置客户端模式的情况下,我将创建一个Ignite服务器节点。

因此,现在我决定成为该服务器节点的客户端,但是我不想再次设置所有参数。 仅通过为meta和data缓存名称提供FileSystem名称,就没有办法进行连接吗? 如果我将conf存储为二进制对象,是否发现它脏了?

如果有人可以就这个话题为我提供建议,我会很高兴:)

最好的祝福

晚上好,谢谢您的迅速答复。

正如我所说,我发现我的配置有误(我认为)。 如果需要,我将所有相同的配置都放进去。 我以节点的身份启动节点,但似乎首先以服务器运行。

您知道为什么现在作为客户端连接时现在需要再次提供所有配置吗? 作为客户端连接时,有没有办法不放置整个conf?

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.
-->

<!--
    Ignite Spring configuration file to startup ignite cache.

    When starting a standalone node, you need to execute the following command:
    {IGNITE_HOME}/bin/ignite.{bat|sh} examples/config/filesystem/example-igfs.xml

    When starting Ignite from Java IDE, pass path to this file into Ignition:
    Ignition.start("examples/config/filesystem/example-igfs.xml");
-->
<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">

    <!--
        Optional description.
    -->
    <description>
        Spring file for ignite configuration with client available endpoints.
    </description>

    <!--
        Initialize property configurer so we can reference environment variables.
    -->
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_FALLBACK"/>
        <property name="searchSystemEnvironment" value="true"/>
    </bean>

    <!--
        Configuration below demonstrates how to setup a IgniteFs node with file data.
    -->
    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">


        <property name="fileSystemConfiguration">
            <list>
                <bean class="org.apache.ignite.configuration.FileSystemConfiguration">
                    <property name="name" value="igfs"/>
                    <property name="metaCacheName" value="igfs-meta"/>
                    <property name="dataCacheName" value="igfs-data"/>

                    <!-- Must correlate with cache affinity mapper. -->
                    <property name="blockSize" value="#{128 * 1024}"/>
                    <property name="perNodeBatchSize" value="512"/>
                    <property name="perNodeParallelBatchCount" value="16"/>

                    <!-- Set number of prefetch blocks. -->
                    <property name="prefetchBlocks" value="32"/>

                    <!--
                        Example of configured IPC loopback endpoint.
                    -->
                    <!--
                    <property name="ipcEndpointConfiguration">
                        <bean class="org.apache.ignite.igfs.IgfsIpcEndpointConfiguration">
                            <property name="type" value="TCP" />
                        </bean>
                    </property>
                    -->

                    <!--
                        Example of configured shared memory endpoint.
                    -->
                    <!--
                    <property name="ipcEndpointConfiguration">
                        <bean class="org.apache.ignite.igfs.IgfsIpcEndpointConfiguration">
                            <property name="type" value="SHMEM" />
                        </bean>
                    </property>
                    -->
                </bean>
            </list>
        </property>

        <property name="cacheConfiguration">
            <list>
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="igfs-data"/>
                    <property name="cacheMode" value="PARTITIONED"/>
                    <property name="atomicityMode" value="TRANSACTIONAL"/>
                    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
                    <property name="backups" value="0"/>
                    <property name="affinityMapper">
                        <bean class="org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper">
                            <!-- Haw many blocks in row will be stored on the same node. -->
                            <constructor-arg value="512"/>
                        </bean>
                    </property>
                </bean>

                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="igfs-meta"/>
                    <property name="cacheMode" value="REPLICATED"/>
                    <property name="atomicityMode" value="TRANSACTIONAL"/>
                    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
                </bean>
            </list>
        </property>

        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <!--
                        Ignition provides several options for automatic discovery that can be used
                        instead os static IP based discovery. For information on all options refer
                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
                    -->
                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                        <property name="addresses">
                            <list>
                                <!-- In distributed environment, replace with actual host IP address. -->
                                <value>127.0.0.1:47500..47509</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>

Java配置

IgniteConfiguration config = new IgniteConfiguration();

FileSystemConfiguration fsConfig = new FileSystemConfiguration();
fsConfig.setName("igfs");
fsConfig.setMetaCacheName("igfs-meta");
fsConfig.setDataCacheName("igfs-data");
fsConfig.setBlockSize(128 * 1024);
fsConfig.setPerNodeBatchSize(512);
fsConfig.setPerNodeParallelBatchCount(16);
fsConfig.setPrefetchBlocks(32);

CacheConfiguration fsDataCache = new CacheConfiguration();
fsDataCache.setName("igfs-data");
fsDataCache.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
fsDataCache.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
fsDataCache.setBackups(0);
fsDataCache.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(512));

CacheConfiguration fsMetadataCache = new CacheConfiguration();
fsMetadataCache.setCacheMode(CacheMode.REPLICATED);
fsMetadataCache.setName("igfs-meta");
fsMetadataCache.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
fsMetadataCache.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

config = new IgniteConfiguration();
config.setClientMode(true); 
config.setWorkDirectory("c:/temp/ignite/instance");
config.setFileSystemConfiguration(fsConfig);    
config.setCacheConfiguration(fsDataCache, fsMetadataCache);

TcpDiscoverySpi discoverySpi=new TcpDiscoverySpi();
discoverySpi.setLocalPort(47506);
discoverySpi.setLocalPortRange(20);
TcpDiscoveryVmIpFinder ipFinder=new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509"));
discoverySpi.setIpFinder(ipFinder);

config.setDiscoverySpi(discoverySpi);

Ignite ignite = Ignition.start(config);

再次感谢你

目前无法仅设置缓存名称和IGFS名称。 您甚至必须为客户端节点提供完整的配置。 我们将来会对此进行一些改进,但是我怀疑我们能否将配置简化为几个字符串,因为客户端与基础文件系统进行通信,因此无论如何我们都必须保留一些配置。

弗拉基米尔。

对于那些对此感兴趣的人,我做了一段代码,使客户更容易。

对于服务器

IgniteConfiguration configBin = new IgniteConfiguration();
CacheConfiguration cacheConfig = new CacheConfiguration();      
configBin.setCacheConfiguration(cacheConfig);

Ignite igniteFSCache = Ignition.start(configBin);
IgniteCache<String, Object> binaryCache = igniteFSCache.getOrCreateCache("confCache").withKeepBinary();

FileSystemConfiguration fsConfig = new FileSystemConfiguration();
fsConfig.setName("igfs");
fsConfig.setMetaCacheName("igfs-meta");
fsConfig.setDataCacheName("igfs-data");
fsConfig.setBlockSize(128 * 1024);
fsConfig.setPerNodeBatchSize(512);
fsConfig.setPerNodeParallelBatchCount(16);
fsConfig.setPrefetchBlocks(32);

binaryCache.put("fsConfig", fsConfig);

CacheConfiguration fsDataCache = new CacheConfiguration();
fsDataCache.setName("igfs-data");
fsDataCache.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
fsDataCache.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
fsDataCache.setBackups(0);
fsDataCache.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(512));

binaryCache.put("fsDataCache", fsDataCache);

CacheConfiguration fsMetadataCache = new CacheConfiguration();
fsMetadataCache.setCacheMode(CacheMode.REPLICATED);
fsMetadataCache.setName("igfs-meta");
fsMetadataCache.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
fsMetadataCache.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

binaryCache.put("fsMetadataCache", fsMetadataCache);

IgniteConfiguration config = new IgniteConfiguration();
config.setWorkDirectory("c:/temp/ignite/instance");
config.setFileSystemConfiguration(fsConfig);    
config.setCacheConfiguration(fsDataCache, fsMetadataCache);
config.setGridName("CacheGrid");


TcpDiscoverySpi discoverySpi=new TcpDiscoverySpi();
discoverySpi.setLocalPort(47506);
discoverySpi.setLocalPortRange(20);

TcpDiscoveryVmIpFinder ipFinder=new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509"));
discoverySpi.setIpFinder(ipFinder);    
config.setDiscoverySpi(discoverySpi);

Ignite ignite = Ignition.getOrStart(config);

对于客户

IgniteConfiguration configBin = new IgniteConfiguration();

configBin.setClientMode(true);  
Ignite igniteFSCache = Ignition.start(configBin);
IgniteCache<String, Object> binaryCache = igniteFSCache.getOrCreateCache("confCache").withKeepBinary();

BinaryObject fsConfig =  (BinaryObject)binaryCache.get("fsConfig");
FileSystemConfiguration fsConf = (FileSystemConfiguration)fsConfig.deserialize();
CacheConfiguration fsDataCache =  (CacheConfiguration)binaryCache.get("fsDataCache");    
CacheConfiguration fsMetadataCache =  (CacheConfiguration)binaryCache.get("fsMetadataCache");    

IgniteConfiguration config = new IgniteConfiguration();
config.setWorkDirectory("c:/temp/ignite/instance");
config.setFileSystemConfiguration(fsConf);  
config.setCacheConfiguration(fsDataCache, fsMetadataCache);
config.setGridName("CacheGrid");
config.setClientMode(true);

Ignite ignite = Ignition.getOrStart(config);

最好的祝福

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM