Search in sources :

Example 11 with LuceneServerConfiguration

use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.

the class AckedCopyTest method setUp.

public void setUp(int chunkSize, int ackEvery, int maxInFlight) throws IOException {
    // setup S3 for backup/restore
    s3Directory = folder.newFolder("s3").toPath();
    archiverDirectory = folder.newFolder("archiver").toPath();
    api = S3Mock.create(8011, s3Directory.toAbsolutePath().toString());
    api.start();
    s3 = new AmazonS3Client(new AnonymousAWSCredentials());
    s3.setEndpoint("http://127.0.0.1:8011");
    s3.createBucket(BUCKET_NAME);
    archiver = new ArchiverImpl(s3, BUCKET_NAME, archiverDirectory, new TarImpl(Tar.CompressionMode.LZ4));
    String extraConfig = String.join("\n", "FileCopyConfig:", "  ackedCopy: true", "  chunkSize: " + chunkSize, "  ackEvery: " + ackEvery, "  maxInFlight: " + maxInFlight);
    // set up primary servers
    String testIndex = "test_index";
    LuceneServerConfiguration luceneServerPrimaryConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.PRIMARY, folder.getRoot(), extraConfig);
    GlobalState globalStatePrimary = GlobalState.createState(luceneServerPrimaryConfiguration);
    luceneServerPrimary = new GrpcServer(grpcCleanup, luceneServerPrimaryConfiguration, folder, false, globalStatePrimary, luceneServerPrimaryConfiguration.getIndexDir(), testIndex, globalStatePrimary.getPort(), archiver);
    replicationServerPrimary = new GrpcServer(grpcCleanup, luceneServerPrimaryConfiguration, folder, true, globalStatePrimary, luceneServerPrimaryConfiguration.getIndexDir(), testIndex, luceneServerPrimaryConfiguration.getReplicationPort(), archiver);
    // set up secondary servers
    LuceneServerConfiguration luceneServerSecondaryConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.REPLICA, folder.getRoot(), extraConfig);
    GlobalState globalStateSecondary = GlobalState.createState(luceneServerSecondaryConfiguration);
    luceneServerSecondary = new GrpcServer(grpcCleanup, luceneServerSecondaryConfiguration, folder, false, globalStateSecondary, luceneServerSecondaryConfiguration.getIndexDir(), testIndex, globalStateSecondary.getPort(), archiver);
    replicationServerSecondary = new GrpcServer(grpcCleanup, luceneServerSecondaryConfiguration, folder, true, globalStateSecondary, luceneServerSecondaryConfiguration.getIndexDir(), testIndex, globalStateSecondary.getReplicationPort(), archiver);
}
Also used : AmazonS3Client(com.amazonaws.services.s3.AmazonS3Client) ArchiverImpl(com.yelp.nrtsearch.server.backup.ArchiverImpl) LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState) AnonymousAWSCredentials(com.amazonaws.auth.AnonymousAWSCredentials) TarImpl(com.yelp.nrtsearch.server.backup.TarImpl)

Example 12 with LuceneServerConfiguration

use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.

the class BackupRestoreIndexRequestHandlerTest method setUpGrpcServer.

private GrpcServer setUpGrpcServer() throws IOException {
    LuceneServerConfiguration luceneServerConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.STANDALONE, folder.getRoot());
    GlobalState globalState = GlobalState.createState(luceneServerConfiguration);
    return new GrpcServer(grpcCleanup, luceneServerConfiguration, folder, false, globalState, luceneServerConfiguration.getIndexDir(), "test_index", globalState.getPort(), archiver);
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState)

Example 13 with LuceneServerConfiguration

use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.

the class CustomFieldTypeTest method setUpGrpcServer.

private GrpcServer setUpGrpcServer(CollectorRegistry collectorRegistry) throws IOException {
    String testIndex = "test_index";
    LuceneServerConfiguration luceneServerConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.STANDALONE, folder.getRoot());
    GlobalState globalState = GlobalState.createState(luceneServerConfiguration);
    return new GrpcServer(collectorRegistry, grpcCleanup, luceneServerConfiguration, folder, false, globalState, luceneServerConfiguration.getIndexDir(), testIndex, globalState.getPort(), null, Collections.singletonList(new TestFieldTypePlugin()));
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState)

Example 14 with LuceneServerConfiguration

use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.

the class LuceneServerTest method setUpGrpcServer.

private GrpcServer setUpGrpcServer(CollectorRegistry collectorRegistry) throws IOException {
    String testIndex = "test_index";
    LuceneServerConfiguration luceneServerConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.STANDALONE, folder.getRoot());
    GlobalState globalState = GlobalState.createState(luceneServerConfiguration);
    return new GrpcServer(collectorRegistry, grpcCleanup, luceneServerConfiguration, folder, false, globalState, luceneServerConfiguration.getIndexDir(), testIndex, globalState.getPort(), null, Collections.emptyList());
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState)

Example 15 with LuceneServerConfiguration

use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.

the class LuceneServerTest method setUpReplicaGrpcServer.

private GrpcServer setUpReplicaGrpcServer(CollectorRegistry collectorRegistry) throws IOException {
    String testIndex = "test_index";
    LuceneServerConfiguration luceneServerReplicaConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.REPLICA, folder.getRoot(), getExtraConfig());
    GlobalState globalStateSecondary = GlobalState.createState(luceneServerReplicaConfiguration);
    return new GrpcServer(grpcCleanup, luceneServerReplicaConfiguration, folder, false, globalStateSecondary, luceneServerReplicaConfiguration.getIndexDir(), testIndex, globalStateSecondary.getPort(), archiver);
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState)

Aggregations

LuceneServerConfiguration (com.yelp.nrtsearch.server.config.LuceneServerConfiguration)34 GlobalState (com.yelp.nrtsearch.server.luceneserver.GlobalState)17 Test (org.junit.Test)10 ByteArrayInputStream (java.io.ByteArrayInputStream)6 AnonymousAWSCredentials (com.amazonaws.auth.AnonymousAWSCredentials)3 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)3 ArchiverImpl (com.yelp.nrtsearch.server.backup.ArchiverImpl)3 TarImpl (com.yelp.nrtsearch.server.backup.TarImpl)3 GrpcServer (com.yelp.nrtsearch.server.grpc.GrpcServer)3 PersistentGlobalState (com.yelp.nrtsearch.server.luceneserver.state.PersistentGlobalState)3 File (java.io.File)3 Before (org.junit.Before)3 BackendGlobalState (com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState)2 LegacyGlobalState (com.yelp.nrtsearch.server.luceneserver.state.LegacyGlobalState)2 Path (java.nio.file.Path)2 ArrayList (java.util.ArrayList)2 Inject (com.google.inject.Inject)1 Provides (com.google.inject.Provides)1 Singleton (com.google.inject.Singleton)1 Archiver (com.yelp.nrtsearch.server.backup.Archiver)1