1

Hi I'm new in using FluentCassandra. I'm having an error "CassandraOperationException" in adding a million data. It says "No connection could be made because all servers have failed." Please help me on how to solve this problem.

This is my code on adding a million data

using (var db = new CassandraContext(keyspace: KeyspaceName, server: Server))
        {
            var x = 0;
            do
            {
                var key = System.Guid.NewGuid().ToString();

                var postFamily = db.GetColumnFamily("Posts");

                // create post
                dynamic post = postFamily.CreateRecord(key);
                post.Title = key;
                post.Author = tbAuthor.Text + x;
                post.Body = rtbBody.Text + x;
                post.PostedOn = DateTime.Now;

                cmbTitle.Items.Add(post.Title);
                //Clear();

                // attach the post to the database
                db.Attach(post);

                // save the changes
                db.SaveChanges();

                x++;
            }
            while (x != 100000);
        }

Thanks in advance!

4

0 回答 0