2016-11-10 2 views
0

Ich bin neu bei Apache Ignite und ich versuche, die FileSystem-Funktion zu verwenden.zünden Dateisystem: Cluster-Gruppe ist leer

Wenn ich die XML-Konfigurationsdatei bin mit allen funktioniert gut, aber wenn die conf zu JAVA Drehen erhalte ich diese Fehlermeldung:

 
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 

ich die Lösung während des Schreibens gefunden habe, aber ich habe eine andere Frage. Es hat nicht funktioniert, weil ich es im Client-Modus gestartet habe (natürlich ...). Aber mit dem XML, ohne den Client-Modus explizit festgelegt, werde ich einen Ignite-Server-Knoten erstellen.

So, jetzt habe ich beschlossen, ein Client dieses Server-Knotens zu werden, aber ich möchte nicht alle Parameter erneut festlegen. Gibt es keine Möglichkeit, eine Verbindung herzustellen, indem Sie beispielsweise den Namen des Meta - und Daten - Caches mit dem Namen des FileSystems angeben? Finden Sie es schmutzig, wenn ich das conf als binäre Objekte speichere (und wenn es funktioniert ...)?

Ich werde mich freuen, wenn mir jemand zu diesem Thema :)

Mit freundlichen Grüßen für Ihre schnelle Antwort

+0

können Sie bitte XML-Konfigurations sowie Java Config bieten - könnte hilfreich sein, um zu sehen, Was ist los mit dir. –

Antwort

0

Guten Abend und vielen Dank beraten können.

Wie gesagt, ich habe einen Fehler in meiner Konfiguration gefunden (glaube ich). Ich habe alle die gleichen boh Konfigurationen, wenn nötig. Ich habe den Knoten als Client gestartet, scheint aber zuerst als Server ausgeführt zu werden.

Wissen Sie, warum ich jetzt wieder alle Config bereitstellen muss, wenn Sie als Client verbinden? Gibt es eine Möglichkeit, den gesamten conf nicht als Client zu verbinden?

XML-Konfigurations

<?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 Config

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); 

Vielen Dank noch einmal

0

Es ist unmöglich, im Moment nur Cache-Namen und IGFS Namen einzustellen. Sie müssen die vollständige Konfiguration auch für den Client-Knoten bereitstellen. Wir werden das in Zukunft etwas verbessern, aber ich bezweifle, dass wir die Konfiguration auf mehrere Strings vereinfachen können, da der Client mit dem zugrunde liegenden Dateisystem kommuniziert, also müssen wir trotzdem einige Config behalten.

Vladimir.

+0

Vielen Dank @Vladimir für Ihre Antwort, es ist, was ich bedauert wurde. Es ist kein Problem, ich werde es im Moment machen und einen Weg finden, diese Ebene zu abstrahieren. Einen schönen Tag noch! Sylvain –

0

Für diejenigen, die daran interessiert sind, habe ich einen Code, den ich gemacht habe, um den Client einfacher zu machen.

Für den Server

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); 

Für die Kunden

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); 

Mit freundlichen Grüßen