Java Code Examples for org.apache.ignite.configuration.DataStorageConfiguration#setStoragePath()

The following examples show how to use org.apache.ignite.configuration.DataStorageConfiguration#setStoragePath() . 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: IgniteUidAsConsistentIdMigrationTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    final IgniteConfiguration cfg = super.getConfiguration(gridName);

    if (configuredConsistentId != null)
        cfg.setConsistentId(configuredConsistentId);

    final DataStorageConfiguration dsCfg = new DataStorageConfiguration();

    if (placeStorageInTemp) {
        final File tempDir = new File(System.getProperty("java.io.tmpdir"));

        pstStoreCustomPath = new File(tempDir, "Store");
        pstWalStoreCustomPath = new File(tempDir, "WalStore");
        pstWalArchCustomPath = new File(tempDir, "WalArchive");

        dsCfg.setStoragePath(pstStoreCustomPath.getAbsolutePath());
        dsCfg.setWalPath(pstWalStoreCustomPath.getAbsolutePath());
        dsCfg.setWalArchivePath(pstWalArchCustomPath.getAbsolutePath());
    }

    dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
        .setMaxSize(32L * 1024 * 1024)
        .setPersistenceEnabled(true));

    cfg.setDataStorageConfiguration(dsCfg);

    if (strLog != null)
        cfg.setGridLogger(strLog);

    return cfg;
}
 
Example 2
Source File: IgniteChangeGlobalStateAbstractTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @param gridName Grid name.
 */
@Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception {
    final IgniteConfiguration cfg = super.getConfiguration(gridName);

    DataStorageConfiguration pCfg = new DataStorageConfiguration();

    pCfg.setStoragePath(testName() + "/db");
    pCfg.setWalArchivePath(testName() + "/db/wal/archive");
    pCfg.setWalPath(testName() + "/db/wal");

    pCfg.setPageSize(1024);
    pCfg.setConcurrencyLevel(64);

    pCfg.setWalMode(WALMode.LOG_ONLY);

    pCfg.setDefaultDataRegionConfiguration(
        new DataRegionConfiguration().setMaxSize(200L * 1024 * 1024).setPersistenceEnabled(true));

    cfg.setDataStorageConfiguration(pCfg);

    return cfg;
}
 
Example 3
Source File: GridActivateExtensionTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setConsistentId("ConsId" + (condId++));
    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(primaryIpFinder);

    DataStorageConfiguration pCfg = new DataStorageConfiguration();

    pCfg.setStoragePath(testName + "/db");
    pCfg.setWalArchivePath(testName + "/db/wal/archive");
    pCfg.setWalPath(testName + "/db/wal");

    pCfg.setDefaultDataRegionConfiguration(
            new DataRegionConfiguration().setMaxSize(200L * 1024 * 1024).setPersistenceEnabled(true));

    pCfg.setWalMode(WALMode.LOG_ONLY);

    pCfg.setPageSize(1024);
    pCfg.setConcurrencyLevel(64);

    cfg.setDataStorageConfiguration(pCfg);

    return cfg;
}
 
Example 4
Source File: AgentClusterDemo.java    From ignite with Apache License 2.0 2 votes vote down vote up
/**
 * Configure node.
 *
 * @param basePort Base port.
 * @param gridIdx Ignite instance name index.
 * @param client If {@code true} then start client node.
 * @return IgniteConfiguration
 */
private static IgniteConfiguration igniteConfiguration(int basePort, int gridIdx, boolean client)
    throws IgniteCheckedException {
    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setGridLogger(new Slf4jLogger());

    cfg.setIgniteInstanceName((client ? CLN_NODE_NAME : SRV_NODE_NAME) + gridIdx);
    cfg.setLocalHost("127.0.0.1");
    cfg.setEventStorageSpi(new MemoryEventStorageSpi());
    cfg.setConsistentId(cfg.getIgniteInstanceName());

    File workDir = new File(U.workDirectory(null, null), "demo-work");

    cfg.setWorkDirectory(workDir.getAbsolutePath());

    int[] evts = new int[EVTS_DISCOVERY.length + VISOR_TASK_EVTS.length];

    System.arraycopy(EVTS_DISCOVERY, 0, evts, 0, EVTS_DISCOVERY.length);
    System.arraycopy(VISOR_TASK_EVTS, 0, evts, EVTS_DISCOVERY.length, VISOR_TASK_EVTS.length);

    cfg.setIncludeEventTypes(evts);

    cfg.getConnectorConfiguration().setPort(basePort);

    System.setProperty(IGNITE_JETTY_PORT, String.valueOf(basePort + 10));

    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();

    int discoPort = basePort + 20;

    ipFinder.setAddresses(Collections.singletonList("127.0.0.1:" + discoPort + ".." + (discoPort + NODE_CNT - 1)));

    // Configure discovery SPI.
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

    discoSpi.setLocalPort(discoPort);
    discoSpi.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(discoSpi);

    TcpCommunicationSpi commSpi = new TcpCommunicationSpi();

    commSpi.setSharedMemoryPort(-1);
    commSpi.setMessageQueueLimit(10);

    int commPort = basePort + 30;

    commSpi.setLocalPort(commPort);

    cfg.setCommunicationSpi(commSpi);
    cfg.setGridLogger(new Slf4jLogger(log));
    cfg.setMetricsLogFrequency(0);

    DataRegionConfiguration dataRegCfg = new DataRegionConfiguration();
    dataRegCfg.setName("demo");
    dataRegCfg.setMetricsEnabled(true);
    dataRegCfg.setMaxSize(DFLT_DATA_REGION_INITIAL_SIZE);
    dataRegCfg.setPersistenceEnabled(true);

    DataStorageConfiguration dataStorageCfg = new DataStorageConfiguration();
    dataStorageCfg.setMetricsEnabled(true);
    dataStorageCfg.setStoragePath(PdsConsistentIdProcessor.DB_DEFAULT_FOLDER);
    dataStorageCfg.setDefaultDataRegionConfiguration(dataRegCfg);
    dataStorageCfg.setSystemRegionMaxSize(DFLT_DATA_REGION_INITIAL_SIZE);

    dataStorageCfg.setWalMode(LOG_ONLY);
    dataStorageCfg.setWalSegments(WAL_SEGMENTS);
    dataStorageCfg.setWalSegmentSize(WAL_SEGMENT_SZ);

    cfg.setDataStorageConfiguration(dataStorageCfg);

    cfg.setClientMode(client);

    return cfg;
}