Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setIgniteInstanceName()
The following examples show how to use
org.apache.ignite.configuration.IgniteConfiguration#setIgniteInstanceName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientConnectorConfigurationValidationSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * Get base node configuration. * * @return Configuration. * @throws Exception If failed. */ @SuppressWarnings("unchecked") private IgniteConfiguration baseConfiguration() throws Exception { final IgniteConfiguration cfg = super.getConfiguration(); cfg.setIgniteInstanceName(ClientConnectorConfigurationValidationSelfTest.class.getName() + "-" + NODE_IDX_GEN.incrementAndGet()); cfg.setLocalHost("127.0.0.1"); cfg.setMarshaller(new BinaryMarshaller()); TcpDiscoverySpi spi = new TcpDiscoverySpi(); spi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); cfg.setDiscoverySpi(spi); CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME) .setIndexedTypes(ClientConnectorKey.class, ClientConnectorValue.class); cfg.setCacheConfiguration(ccfg); return cfg; }
Example 2
Source File: FetchingQueryCursorStressTest.java From ignite with Apache License 2.0 | 6 votes |
/** * Create configuration. * * @param idx Index. * @param client Client flag. * @return Configuration. */ @SuppressWarnings("unchecked") private static IgniteConfiguration config(int idx, boolean client) { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName("grid-" + idx); cfg.setClientMode(client); CacheConfiguration ccfg = new CacheConfiguration(); ccfg.setName(CACHE_NAME); ccfg.setIndexedTypes(Integer.class, Person.class); cfg.setMarshaller(new BinaryMarshaller()); cfg.setCacheConfiguration(ccfg); cfg.setLocalHost("127.0.0.1"); return cfg; }
Example 3
Source File: IgniteModuleMemberRegistrationIT.java From hibernate-ogm-ignite with GNU Lesser General Public License v2.1 | 6 votes |
private IgniteConfiguration createConfig() { IgniteConfiguration config = new IgniteConfiguration(); config.setIgniteInstanceName( "OgmTestGrid" ); config.setClientMode( false ); BinaryConfiguration binaryConfiguration = new BinaryConfiguration(); binaryConfiguration.setNameMapper( new BinaryBasicNameMapper( true ) ); binaryConfiguration.setCompactFooter( false ); // it is necessary only for embedded collections (@ElementCollection) config.setBinaryConfiguration( binaryConfiguration ); TransactionConfiguration transactionConfiguration = new TransactionConfiguration(); // I'm going to use PESSIMISTIC here because some people had problem with it and it would be nice if tests // can highlight the issue. Ideally, we would want to test the different concurrency and isolation level. transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.PESSIMISTIC ); transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED ); config.setTransactionConfiguration( transactionConfiguration ); return config; }
Example 4
Source File: GridAbstractTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Starts new grid with given name. * * @param gridName Grid name. * @param client Client mode. * @param cfgUrl Config URL. * @return Started grid. * @throws Exception If failed. */ protected Ignite startGridWithSpringCtx(String gridName, boolean client, String cfgUrl) throws Exception { IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap = IgnitionEx.loadConfigurations(cfgUrl); IgniteConfiguration cfg = F.first(cfgMap.get1()); cfg.setIgniteInstanceName(gridName); cfg.setClientMode(client); return IgnitionEx.start(cfg, cfgMap.getValue()); }
Example 5
Source File: MetaStorageCompatibilityTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Updates the given ignite configuration. * * @param cfg Ignite configuration to be updated. * @param consistentId Consistent id. * @param failOnFileRmv Indicates that an exception should be trown when partition/index file is going to be removed. * @return Updated configuration. */ private static IgniteConfiguration prepareConfig( IgniteConfiguration cfg, @Nullable String consistentId, @Nullable String failOnFileRmv ) { cfg.setLocalHost("127.0.0.1"); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(GridCacheAbstractFullApiSelfTest.LOCAL_IP_FINDER); cfg.setDiscoverySpi(disco); cfg.setPeerClassLoadingEnabled(false); DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true) .setInitialSize(10L * 1024 * 1024) .setMaxSize(10L * 1024 * 1024)) .setPageSize(4096); cfg.setDataStorageConfiguration(memCfg); if (consistentId != null) { cfg.setIgniteInstanceName(consistentId); cfg.setConsistentId(consistentId); } if (failOnFileRmv != null) cfg.getDataStorageConfiguration().setFileIOFactory(new FailingFileIOFactory(failOnFileRmv)); return cfg; }
Example 6
Source File: MvccEmptyTransactionSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Create config. * * @param name Name. * @param client Client flag. * @return Config. */ private static IgniteConfiguration config(String name, boolean client) { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName(name); cfg.setClientMode(client); return cfg; }
Example 7
Source File: CacheFutureExceptionSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName(igniteInstanceName); return cfg; }
Example 8
Source File: IgfsModesSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * Startup secondary file system. * * @throws Exception If failed. */ private void startUpSecondary() throws Exception { FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setName("igfs-secondary"); igfsCfg.setBlockSize(512 * 1024); igfsCfg.setDefaultMode(PRIMARY); IgfsIpcEndpointConfiguration endpointCfg = new IgfsIpcEndpointConfiguration(); endpointCfg.setType(IgfsIpcEndpointType.TCP); endpointCfg.setPort(11500); CacheConfiguration dataCacheCfg = defaultCacheConfiguration(); dataCacheCfg.setCacheMode(PARTITIONED); dataCacheCfg.setNearConfiguration(null); dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); dataCacheCfg.setBackups(0); dataCacheCfg.setAtomicityMode(TRANSACTIONAL); CacheConfiguration metaCacheCfg = defaultCacheConfiguration(); metaCacheCfg.setCacheMode(REPLICATED); metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); metaCacheCfg.setAtomicityMode(TRANSACTIONAL); igfsCfg.setMetaCacheConfiguration(metaCacheCfg); igfsCfg.setDataCacheConfiguration(dataCacheCfg); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName("igfs-grid-secondary"); TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); cfg.setDiscoverySpi(discoSpi); cfg.setFileSystemConfiguration(igfsCfg); cfg.setLocalHost("127.0.0.1"); cfg.setConnectorConfiguration(null); igfsSecondary = (IgfsImpl)G.start(cfg).fileSystem("igfs-secondary"); }
Example 9
Source File: IgfsMetricsSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * Start a grid with the secondary file system. * * @throws Exception If failed. */ @SuppressWarnings("unchecked") private void startSecondary() throws Exception { FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setName(IGFS_SECONDARY); igfsCfg.setBlockSize(SECONDARY_BLOCK_SIZE); igfsCfg.setDefaultMode(PRIMARY); igfsCfg.setIpcEndpointConfiguration(SECONDARY_REST_CFG); CacheConfiguration dataCacheCfg = defaultCacheConfiguration(); dataCacheCfg.setCacheMode(PARTITIONED); dataCacheCfg.setNearConfiguration(null); dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); dataCacheCfg.setBackups(0); dataCacheCfg.setAtomicityMode(TRANSACTIONAL); CacheConfiguration metaCacheCfg = defaultCacheConfiguration(); metaCacheCfg.setCacheMode(REPLICATED); metaCacheCfg.setNearConfiguration(null); metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); metaCacheCfg.setAtomicityMode(TRANSACTIONAL); igfsCfg.setMetaCacheConfiguration(metaCacheCfg); igfsCfg.setDataCacheConfiguration(dataCacheCfg); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName("grid-secondary"); TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); cfg.setDiscoverySpi(discoSpi); cfg.setFileSystemConfiguration(igfsCfg); cfg.setLocalHost("127.0.0.1"); Ignite g = G.start(cfg); igfsSecondary = (IgfsImpl)g.fileSystem(IGFS_SECONDARY); }
Example 10
Source File: ClientStartNodeTask.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected Object executeJob(int gridSize, String type) { log.info(">>> Starting new grid node [currGridSize=" + gridSize + ", arg=" + type + "]"); if (type == null) throw new IllegalArgumentException("Node type to start should be specified."); IgniteConfiguration cfg = getConfig(type); // Generate unique for this VM Ignite instance name. String igniteInstanceName = cfg.getIgniteInstanceName() + " (" + UUID.randomUUID() + ")"; // Update Ignite instance name (required to be unique). cfg.setIgniteInstanceName(igniteInstanceName); // Start new node in current VM. Ignite g = G.start(cfg); log.info(">>> Grid started [nodeId=" + g.cluster().localNode().id() + ", name='" + g.name() + "']"); return true; }
Example 11
Source File: GridLog4jCorrectFileNameTest.java From ignite with Apache License 2.0 | 4 votes |
/** * Creates grid configuration. * * @param igniteInstanceName Ignite instance name. * @return Grid configuration. */ private static IgniteConfiguration getConfiguration(String igniteInstanceName) { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName(igniteInstanceName); cfg.setGridLogger(new Log4JLogger()); cfg.setConnectorConfiguration(null); TcpDiscoverySpi disco = new TcpDiscoverySpi(); TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(false); ipFinder.setAddresses(Collections.singleton("127.0.0.1:47500..47502")); disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); return cfg; }
Example 12
Source File: IgfsAbstractBaseSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * Start grid with IGFS. * * @param igniteInstanceName Ignite instance name. * @param igfsName IGFS name * @param mode IGFS mode. * @param secondaryFs Secondary file system (optional). * @param restCfg Rest configuration string (optional). * @param ipFinder IP finder. * @return Started grid instance. * @throws Exception If failed. */ @SuppressWarnings("unchecked") protected Ignite startGridWithIgfs(String igniteInstanceName, String igfsName, IgfsMode mode, @Nullable IgfsSecondaryFileSystem secondaryFs, @Nullable IgfsIpcEndpointConfiguration restCfg, TcpDiscoveryIpFinder ipFinder) throws Exception { FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setName(igfsName); igfsCfg.setBlockSize(IGFS_BLOCK_SIZE); igfsCfg.setDefaultMode(mode); igfsCfg.setIpcEndpointConfiguration(restCfg); igfsCfg.setSecondaryFileSystem(secondaryFs); igfsCfg.setPrefetchBlocks(PREFETCH_BLOCKS); igfsCfg.setSequentialReadsBeforePrefetch(SEQ_READS_BEFORE_PREFETCH); igfsCfg.setRelaxedConsistency(relaxedConsistency()); igfsCfg.setFragmentizerEnabled(fragmentizerEnabled()); CacheConfiguration dataCacheCfg = defaultCacheConfiguration(); dataCacheCfg.setNearConfiguration(null); dataCacheCfg.setCacheMode(PARTITIONED); dataCacheCfg.setNearConfiguration(null); dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(2)); dataCacheCfg.setBackups(0); dataCacheCfg.setAtomicityMode(TRANSACTIONAL); CacheConfiguration metaCacheCfg = defaultCacheConfiguration(); metaCacheCfg.setNearConfiguration(null); metaCacheCfg.setCacheMode(REPLICATED); metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); metaCacheCfg.setAtomicityMode(TRANSACTIONAL); prepareCacheConfigurations(dataCacheCfg, metaCacheCfg); igfsCfg.setDataCacheConfiguration(dataCacheCfg); igfsCfg.setMetaCacheConfiguration(metaCacheCfg); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName(igniteInstanceName); TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setIpFinder(ipFinder); cfg.setDiscoverySpi(discoSpi); cfg.setFileSystemConfiguration(igfsCfg); cfg.setLocalHost("127.0.0.1"); cfg.setConnectorConfiguration(null); return G.start(cfg); }
Example 13
Source File: HadoopIgfsDualAbstractSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * Start grid with IGFS. * * @param igniteInstanceName Ignite instance name. * @param igfsName IGFS name * @param mode IGFS mode. * @param secondaryFs Secondary file system (optional). * @param restCfg Rest configuration string (optional). * @return Started grid instance. * @throws Exception If failed. */ protected Ignite startGridWithIgfs(String igniteInstanceName, String igfsName, IgfsMode mode, @Nullable IgfsSecondaryFileSystem secondaryFs, @Nullable IgfsIpcEndpointConfiguration restCfg) throws Exception { FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setName(igfsName); igfsCfg.setBlockSize(IGFS_BLOCK_SIZE); igfsCfg.setDefaultMode(mode); igfsCfg.setIpcEndpointConfiguration(restCfg); igfsCfg.setSecondaryFileSystem(secondaryFs); igfsCfg.setPrefetchBlocks(PREFETCH_BLOCKS); igfsCfg.setSequentialReadsBeforePrefetch(SEQ_READS_BEFORE_PREFETCH); CacheConfiguration dataCacheCfg = defaultCacheConfiguration(); dataCacheCfg.setName("dataCache"); dataCacheCfg.setCacheMode(PARTITIONED); dataCacheCfg.setNearConfiguration(null); dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(2)); dataCacheCfg.setBackups(0); dataCacheCfg.setAtomicityMode(TRANSACTIONAL); CacheConfiguration metaCacheCfg = defaultCacheConfiguration(); metaCacheCfg.setName("metaCache"); metaCacheCfg.setCacheMode(REPLICATED); metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); metaCacheCfg.setAtomicityMode(TRANSACTIONAL); igfsCfg.setDataCacheConfiguration(dataCacheCfg); igfsCfg.setMetaCacheConfiguration(metaCacheCfg); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName(igniteInstanceName); TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); cfg.setDiscoverySpi(discoSpi); cfg.setFileSystemConfiguration(igfsCfg); cfg.setLocalHost("127.0.0.1"); cfg.setConnectorConfiguration(null); return G.start(cfg); }
Example 14
Source File: ApplicationConfiguration.java From ignite with Apache License 2.0 | 4 votes |
/** * Ignite instance bean with not default name */ @Bean public Ignite igniteInstanceTWO() { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName(IGNITE_INSTANCE_TWO); CacheConfiguration ccfg = new CacheConfiguration("PersonCache"); ccfg.setIndexedTypes(Integer.class, Person.class); cfg.setCacheConfiguration(ccfg); TcpDiscoverySpi spi = new TcpDiscoverySpi(); spi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); cfg.setDiscoverySpi(spi); return Ignition.start(cfg); }
Example 15
Source File: ApplicationConfiguration.java From ignite with Apache License 2.0 | 4 votes |
/** * Ignite instance bean - no instance name provided on RepositoryConfig */ @Bean public Ignite igniteInstance() { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName(IGNITE_INSTANCE_ONE); CacheConfiguration ccfg = new CacheConfiguration("PersonCache"); ccfg.setIndexedTypes(Integer.class, Person.class); cfg.setCacheConfiguration(ccfg); TcpDiscoverySpi spi = new TcpDiscoverySpi(); spi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); cfg.setDiscoverySpi(spi); return Ignition.start(cfg); }
Example 16
Source File: SpringAppConfig.java From ignite-book-code-samples with GNU General Public License v3.0 | 4 votes |
@Bean public Ignite igniteInstance() { IgniteConfiguration cfg = new IgniteConfiguration(); // Setting some custom name for the node. cfg.setIgniteInstanceName("springDataNode"); // Enabling peer-class loading feature. cfg.setPeerClassLoadingEnabled(true); // Defining and creating a new cache to be used by Ignite Spring Data // repository. CacheConfiguration ccfgDog = new CacheConfiguration("DogCache"); CacheConfiguration ccfgBreed = new CacheConfiguration("BreedCache"); // Setting SQL schema for the cache. ccfgBreed.setIndexedTypes(Long.class, Breed.class); ccfgDog.setIndexedTypes(Long.class, Dog.class); cfg.setCacheConfiguration(new CacheConfiguration[]{ccfgDog, ccfgBreed}); return Ignition.start(cfg); }
Example 17
Source File: ConfigPropertiesTest.java From hibernate-ogm-ignite with GNU Lesser General Public License v2.1 | 4 votes |
private IgniteConfiguration createConfig(String gridName) { IgniteConfiguration result = new IgniteConfiguration(); result.setIgniteInstanceName( gridName ); return result; }
Example 18
Source File: JavaEmbeddedIgniteRDDWithLocalStoreSelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** * @param igniteInstanceName Ignite instance name. * @param client Client. * @throws Exception If failed. * @return Confiuration. */ private static IgniteConfiguration getConfiguration(String igniteInstanceName, boolean client) throws Exception { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setCacheConfiguration(cacheConfiguration()); cfg.setClientMode(client); cfg.setIgniteInstanceName(igniteInstanceName); return cfg; }
Example 19
Source File: RestExecutorSelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** * @param jettyCfg Optional path to file with Jetty XML config. * @return Prepare configuration for cluster node. */ private IgniteConfiguration nodeConfiguration(String jettyCfg) { TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); ipFinder.registerAddresses(Collections.singletonList(new InetSocketAddress("127.0.0.1", 47500))); TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi(); discoverySpi.setIpFinder(ipFinder); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setDiscoverySpi(discoverySpi); CacheConfiguration<Integer, String> dfltCacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); cfg.setCacheConfiguration(dfltCacheCfg); cfg.setIgniteInstanceName(UUID.randomUUID().toString()); if (!F.isEmpty(jettyCfg)) { ConnectorConfiguration conCfg = new ConnectorConfiguration(); conCfg.setJettyPath(resolvePath(jettyCfg)); cfg.setConnectorConfiguration(conCfg); } return cfg; }
Example 20
Source File: RouterFactorySelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setIpFinder(sharedStaticIpFinder); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setDiscoverySpi(discoSpi); cfg.setIgniteInstanceName(igniteInstanceName); return cfg; }