Beispiel #1
0
            public static void CreateCluster()
            {
                erroredOut       = false;
                schemaCreated    = false;
                cassandraCluster = CCMBridge.Create("test", 1);
                try
                {
                    var builder = Cluster.Builder().AddContactPoints(Options.Default.IP_PREFIX + "1");
                    if (Options.Default.USE_COMPRESSION)
                    {
                        builder.WithCompression(CompressionType.Snappy);
                        Console.WriteLine("Using Compression");
                    }
                    if (Options.Default.USE_NOBUFFERING)
                    {
                        builder.WithoutRowSetBuffering();
                        Console.WriteLine("No buffering");
                    }

                    cluster = builder.Build();
                    session = cluster.Connect();
                }
                catch (NoHostAvailableException e)
                {
                    erroredOut = true;
                    foreach (var entry in e.Errors)
                    {
                        Trace.TraceError("Error connecting to " + entry.Key + ": " + entry.Value);
                    }
                    throw new InvalidOperationException("", e);
                }
            }
        public static CCMBridge Create(string name, int nbNodesDC1, int nbNodesDC2)
        {
            CCMBridge bridge = new CCMBridge();

            bridge.ExecuteCCM(string.Format("Create {0} -n {1}:{2} -s -i {3} -b {4}", name, nbNodesDC1, nbNodesDC2, IP_PREFIX, CASSANDRA_VERSION));
            return(bridge);
        }
            public CCMCluster(CCMBridge cassandraCluster, Builder builder)
            {
                int tryNo = 0;

                this.Cluster = builder.AddContactPoints(IP_PREFIX + "1").Build();
RETRY:
                this.CassandraCluster = cassandraCluster;
                try
                {
                    this.Session = Cluster.Connect();
                    if (tryNo > 0)
                    {
                        Cluster.RefreshSchema();
                    }
                }
                catch (NoHostAvailableException e)
                {
                    if (tryNo < 10)
                    {
                        Console.WriteLine("CannotConnect to CCM node - give another try");
                        tryNo++;
                        Thread.Sleep(1000);
                        goto RETRY;
                    }
                    foreach (var entry in e.Errors)
                    {
                        Trace.TraceError("Error connecting to " + entry.Key + ": " + entry.Value);
                    }
                    throw new InvalidOperationException(null, e);
                }
            }
Beispiel #4
0
        public static CCMBridge Create(string name)
        {
            CCMBridge bridge = new CCMBridge();

            bridge.ExecuteCCM(string.Format("Create {0} -b -i {1} {2}", name, Options.Default.IP_PREFIX, Options.Default.CASSANDRA_VERSION));
            return(bridge);
        }
            public static CCMCluster Create(int nbNodesDC1, int nbNodesDC2, Builder builder)
            {
                if (nbNodesDC1 == 0)
                {
                    throw new ArgumentException();
                }

                return(new CCMCluster(CCMBridge.Create("test", nbNodesDC1, nbNodesDC2), builder));
            }
Beispiel #6
0
        public static CCMBridge Create(string name, int nbNodesDC1, int nbNodesDC2, bool useAlreadyExisting = false)
        {
#if !MYTEST
            if (!useAlreadyExisting && (nbNodesDC1 + nbNodesDC2 > 4))
            {
                throw new InvalidOperationException();
            }
#endif

            CCMBridge bridge = new CCMBridge();
            bridge.ExecuteCCM(string.Format("Create {0} -n {1}:{2} -s -i {3} -b {4}", name, nbNodesDC1, nbNodesDC2, Options.Default.IP_PREFIX, Options.Default.CASSANDRA_VERSION), useAlreadyExisting);
            return(bridge);
        }
Beispiel #7
0
            private CCMCluster(CCMBridge ccmBridge, Builder builder)
            {
                int tryNo = 0;

                builder.AddContactPoints(Options.Default.IP_PREFIX + "1");
                if (Options.Default.USE_COMPRESSION)
                {
                    builder.WithCompression(CompressionType.Snappy);
                    Console.WriteLine("Using Compression");
                }
                if (Options.Default.USE_NOBUFFERING)
                {
                    builder.WithoutRowSetBuffering();
                    Console.WriteLine("No buffering");
                }

                this.Cluster = builder.Build();
RETRY:
                this.CCMBridge = ccmBridge;
                try
                {
                    this.Session = Cluster.Connect();
                    if (tryNo > 0)
                    {
                        Cluster.RefreshSchema();
                    }
                }
                catch (NoHostAvailableException e)
                {
                    if (tryNo < 10)
                    {
                        Console.WriteLine("CannotConnect to CCM node - give another try");
                        tryNo++;
                        Thread.Sleep(1000);
                        goto RETRY;
                    }
                    foreach (var entry in e.Errors)
                    {
                        Trace.TraceError("Error connecting to " + entry.Key + ": " + entry.Value);
                    }
                    throw new InvalidOperationException(null, e);
                }
            }
 public static void CreateCluster()
 {
     erroredOut       = false;
     schemaCreated    = false;
     cassandraCluster = CCMBridge.Create("test", 1);
     try
     {
         cluster = Cluster.Builder().AddContactPoints(IP_PREFIX + "1").Build();
         session = cluster.Connect();
     }
     catch (NoHostAvailableException e)
     {
         erroredOut = true;
         foreach (var entry in e.Errors)
         {
             Trace.TraceError("Error connecting to " + entry.Key + ": " + entry.Value);
         }
         throw new InvalidOperationException("", e);
     }
 }
Beispiel #9
0
 public static void Setup(int nbNodesDC1, int nbNodesDC2 = 0, bool useAlreadyExisting = false)
 {
     if (nbNodesDC2 == 0)
     {
         if (nbNodesDC1 != NbNodesDC1)
         {
             Console.WriteLine("Cassandra:" + Options.Default.CASSANDRA_VERSION);
             CCMBridge  = CCMBridge.Create("test", nbNodesDC1, useAlreadyExisting);
             NbNodesDC1 = nbNodesDC1;
             NbNodesDC2 = 0;
         }
     }
     else
     {
         if (nbNodesDC1 != NbNodesDC1 || nbNodesDC2 != NbNodesDC2)
         {
             CCMBridge  = CCMBridge.Create("test", nbNodesDC1, nbNodesDC2, useAlreadyExisting);
             NbNodesDC1 = nbNodesDC1;
             NbNodesDC2 = nbNodesDC2;
         }
     }
 }
Beispiel #10
0
        public static CCMBridge Create(string name, int nbNodesDC1, int nbNodesDC2, bool useAlreadyExisting =false)
        {
            #if !MYTEST
            if (!useAlreadyExisting && (nbNodesDC1 + nbNodesDC2 > 4))
                throw new InvalidOperationException();
            #endif

            CCMBridge bridge = new CCMBridge();
            bridge.ExecuteCCM(string.Format("Create {0} -n {1}:{2} -s -i {3} -b {4}", name, nbNodesDC1, nbNodesDC2, Options.Default.IP_PREFIX, Options.Default.CASSANDRA_VERSION), useAlreadyExisting);
            return bridge;
        }
Beispiel #11
0
 public static CCMBridge Create(string name)
 {
     CCMBridge bridge = new CCMBridge();
     bridge.ExecuteCCM(string.Format("Create {0} -b -i {1} {2}", name, Options.Default.IP_PREFIX, Options.Default.CASSANDRA_VERSION));
     return bridge;
 }
Beispiel #12
0
 public static void Setup(int nbNodesDC1, int nbNodesDC2 = 0,bool useAlreadyExisting = false)
 {
     if (nbNodesDC2 == 0)
     {
         if (nbNodesDC1 != NbNodesDC1)
         {
             Console.WriteLine("Cassandra:" + Options.Default.CASSANDRA_VERSION);
             CCMBridge = CCMBridge.Create("test", nbNodesDC1, useAlreadyExisting);
             NbNodesDC1 = nbNodesDC1;
             NbNodesDC2 = 0;
         }
     }
     else
     {
         if (nbNodesDC1 != NbNodesDC1 || nbNodesDC2 != NbNodesDC2)
         {
             CCMBridge = CCMBridge.Create("test", nbNodesDC1, nbNodesDC2, useAlreadyExisting);
             NbNodesDC1 = nbNodesDC1;
             NbNodesDC2 = nbNodesDC2;
         }
     }
 }
Beispiel #13
0
            private CCMCluster(CCMBridge ccmBridge, Builder builder)
            {
                int tryNo = 0;
                builder.AddContactPoints(Options.Default.IP_PREFIX + "1");
                if (Options.Default.USE_COMPRESSION)
                {
                    builder.WithCompression(CompressionType.Snappy);
                    Console.WriteLine("Using Compression");
                }
                if (Options.Default.USE_NOBUFFERING)
                {
                    builder.WithoutRowSetBuffering();
                    Console.WriteLine("No buffering");
                }

                this.Cluster = builder.Build();
                RETRY:
                this.CCMBridge = ccmBridge;
                try
                {
                    this.Session = Cluster.Connect();
                    if(tryNo>0)
                        Cluster.RefreshSchema();
                }
                catch (NoHostAvailableException e)
                {
                    if (tryNo < 10)
                    {
                        Console.WriteLine("CannotConnect to CCM node - give another try");
                        tryNo++;
                        Thread.Sleep(1000);
                        goto RETRY;
                    }
                    foreach (var entry in e.Errors)
                        Trace.TraceError("Error connecting to " + entry.Key + ": " + entry.Value);
                    throw new InvalidOperationException(null, e);
                }
            }
 public static CCMBridge Create(string name, int nbNodesDC1, int nbNodesDC2)
 {
     CCMBridge bridge = new CCMBridge();
     bridge.ExecuteCCM(string.Format("Create {0} -n {1}:{2} -s -i {3} -b {4}", name, nbNodesDC1, nbNodesDC2, IP_PREFIX, CASSANDRA_VERSION));
     return bridge;
 }
 public static void CreateCluster()
 {
     erroredOut = false;
     schemaCreated = false;
     cassandraCluster = CCMBridge.Create("test", 1);
     try
     {
         cluster = Cluster.Builder().AddContactPoints(IP_PREFIX + "1").Build();
         session = cluster.Connect();
     }
     catch (NoHostAvailableException e)
     {
         erroredOut = true;
         foreach (var entry in e.Errors)
             Trace.TraceError("Error connecting to " + entry.Key + ": " + entry.Value);
         throw new InvalidOperationException("", e);
     }
 }
            private CCMCluster(CCMBridge cassandraCluster, Builder builder)
            {
                this.CassandraCluster = cassandraCluster;
                try
                {
                    this.Cluster = builder.AddContactPoints(IP_PREFIX + "1").Build();
                    this.Session = Cluster.Connect();

                }
                catch (NoHostAvailableException e)
                {
                    foreach (var entry in e.Errors)
                        Trace.TraceError("Error connecting to " + entry.Key + ": " + entry.Value);
                    throw new InvalidOperationException(null, e);
                }
            }
Beispiel #17
0
            public static void CreateCluster()
            {
                erroredOut = false;
                schemaCreated = false;
                cassandraCluster = CCMBridge.Create("test", 1);
                try
                {
                    var builder = Cluster.Builder().AddContactPoints(Options.Default.IP_PREFIX + "1");
                    if (Options.Default.USE_COMPRESSION)
                    {
                        builder.WithCompression(CompressionType.Snappy);
                        Console.WriteLine("Using Compression");
                    }
                    if (Options.Default.USE_NOBUFFERING)
                    {
                        builder.WithoutRowSetBuffering();
                        Console.WriteLine("No buffering");
                    }

                    cluster = builder.Build();
                    session = cluster.Connect();
                }
                catch (NoHostAvailableException e)
                {
                    erroredOut = true;
                    foreach (var entry in e.Errors)
                        Trace.TraceError("Error connecting to " + entry.Key + ": " + entry.Value);
                    throw new InvalidOperationException("", e);
                }
            }
 public CCMCluster(CCMBridge cassandraCluster, Builder builder)
 {
     int tryNo = 0;
     this.Cluster = builder.AddContactPoints(IP_PREFIX + "1").Build();
     RETRY:
     this.CassandraCluster = cassandraCluster;
     try
     {
         this.Session = Cluster.Connect();
         if(tryNo>0)
             Cluster.RefreshSchema();
     }
     catch (NoHostAvailableException e)
     {
         if (tryNo < 10)
         {
             Console.WriteLine("CannotConnect to CCM node - give another try");
             tryNo++;
             Thread.Sleep(1000);
             goto RETRY;
         }
         foreach (var entry in e.Errors)
             Trace.TraceError("Error connecting to " + entry.Key + ": " + entry.Value);
         throw new InvalidOperationException(null, e);
     }
 }