Search in sources :

Example 31 with IgniteConfiguration

use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.

the class IgfsTaskSelfTest method config.

/**
 * Create grid configuration.
 *
 * @param idx Node index.
 * @return Grid configuration
 */
private IgniteConfiguration config(int idx) {
    FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
    igfsCfg.setName("igfs");
    igfsCfg.setBlockSize(BLOCK_SIZE);
    igfsCfg.setDefaultMode(PRIMARY);
    igfsCfg.setFragmentizerEnabled(false);
    CacheConfiguration dataCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    dataCacheCfg.setCacheMode(PARTITIONED);
    dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
    dataCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(1));
    dataCacheCfg.setBackups(0);
    CacheConfiguration metaCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    metaCacheCfg.setCacheMode(REPLICATED);
    metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
    metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
    igfsCfg.setDataCacheConfiguration(dataCacheCfg);
    IgniteConfiguration cfg = new IgniteConfiguration();
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(discoSpi);
    cfg.setFileSystemConfiguration(igfsCfg);
    cfg.setIgniteInstanceName("node-" + idx);
    return cfg;
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FileSystemConfiguration(org.apache.ignite.configuration.FileSystemConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 32 with IgniteConfiguration

use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.

the class SpringAppCfg method igniteInstance.

/**
 * Creating Apache Ignite instance bean. A bean will be passed to {@link IgniteRepositoryFactoryBean} to initialize
 * all Ignite based Spring Data repositories and connect to a cluster.
 */
@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 ccfg = new CacheConfiguration("PersonCache");
    // Setting SQL schema for the cache.
    ccfg.setIndexedTypes(Long.class, Person.class);
    cfg.setCacheConfiguration(ccfg);
    return Ignition.start(cfg);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) Bean(org.springframework.context.annotation.Bean) IgniteRepositoryFactoryBean(org.apache.ignite.springdata.repository.support.IgniteRepositoryFactoryBean)

Example 33 with IgniteConfiguration

use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.

the class RestProcessorTest method testRest.

/**
 * @throws Exception If failed.
 */
public void testRest() throws Exception {
    IgniteConfiguration cfg = getConfiguration((String) null);
    cfg = cacheTestConfiguration(cfg);
    G.start(cfg);
    populateCache();
    deployTasks();
    // Wait until Ok is pressed.
    JOptionPane.showMessageDialog(null, new JComponent[] { new JLabel("Ignite started."), new JLabel("<html>" + "You can use JMX console at <u>http://localhost:1234</u>" + "</html>"), new JLabel("Press OK to stop Ignite.") }, "Ignite Startup JUnit", JOptionPane.INFORMATION_MESSAGE);
    G.stop(true);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) JLabel(javax.swing.JLabel)

Example 34 with IgniteConfiguration

use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.

the class JdbcThinMetadataSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(disco);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 35 with IgniteConfiguration

use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.

the class IgniteCacheDatabaseSharedManager method registerMetricsMBeans.

/**
 * Registers MBeans for all DataRegionMetrics configured in this instance.
 */
private void registerMetricsMBeans() {
    if (U.IGNITE_MBEANS_DISABLED)
        return;
    IgniteConfiguration cfg = cctx.gridConfig();
    for (DataRegionMetrics memMetrics : memMetricsMap.values()) {
        DataRegionConfiguration memPlcCfg = dataRegionMap.get(memMetrics.getName()).config();
        registerMetricsMBean((DataRegionMetricsImpl) memMetrics, memPlcCfg, cfg);
    }
}
Also used : DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) DataRegionMetrics(org.apache.ignite.DataRegionMetrics)

Aggregations

IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2118 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)686 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)404 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)385 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)363 Ignite (org.apache.ignite.Ignite)194 Test (org.junit.Test)182 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)161 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)127 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)123 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)105 TestRecordingCommunicationSpi (org.apache.ignite.internal.TestRecordingCommunicationSpi)98 IgniteEx (org.apache.ignite.internal.IgniteEx)95 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)89 IgniteException (org.apache.ignite.IgniteException)78 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)75 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)72 ConnectorConfiguration (org.apache.ignite.configuration.ConnectorConfiguration)68 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)65 ArrayList (java.util.ArrayList)55