示例#1
0
        public void CreateReplicaCataSetTest()
        {
            try
            {
                System.Console.WriteLine(config.conf.Groups[2].Nodes[0].HostName.ToString());
                System.Console.WriteLine(config.conf.Groups[2].Nodes[0].Port.ToString());
                System.Console.WriteLine(config.conf.Groups[2].Nodes[0].DBPath.ToString());
                string str1 = config.conf.Groups[2].Nodes[0].HostName.ToString();
                string str2 = config.conf.Groups[2].Nodes[0].Port.ToString();
                string str3 = config.conf.Groups[2].Nodes[0].DBPath.ToString();
                sdb.CreateReplicaCataGroup(config.conf.Groups[2].Nodes[0].HostName,
                                           config.conf.Groups[2].Nodes[0].Port,
                                           config.conf.Groups[2].Nodes[0].DBPath,
                                           null);
            }
            catch (BaseException)
            {
            }
            Sequoiadb sdb2 = new Sequoiadb(config.conf.Groups[2].Nodes[0].HostName,
                                           config.conf.Groups[2].Nodes[0].Port);

            sdb2.Connect();
            Assert.IsNotNull(sdb2.Connection);
            sdb2.Disconnect();
        }
        public void createRG()
        {
            // 1. prepare a empty coord by manually

            // 2. get connection
            Sequoiadb db = new Sequoiadb("192.168.20.165", 11810);

            db.Connect();
            //db.ListCollections();

            // 3. create catalog group
            Dictionary <string, string> map = new Dictionary <String, String>();

            map.Add("businessname", "abc");
            map.Add("diaglevel", "5");
            map.Add("omaddr", "susetzb:11830");
            //      db.createReplicaCataGroup("192.168.20.165", 11820, "/opt/sequoiadb/database/cata/11820", map);
            BsonDocument obj = new BsonDocument();

            obj.Add("businessname", "abc");
            obj.Add("diaglevel", 5);
            obj.Add("omaddr", "susetzb:12345");
            db.CreateReplicaCataGroup("192.168.20.165", 11820, "/opt/sequoiadb/database/cata/11820", obj);
            ReplicaGroup rg = db.GetReplicaGroup("SYSCatalogGroup");

            SequoiaDB.Node node = rg.CreateNode("192.168.20.165", 11830, "/opt/sequoiadb/database/cata/11830", map);
            node.Start();
        }