示例#1
0
        public virtual void TestZookeeperCanWrite()
        {
            Runtime.SetProperty("curator-log-events", "true");
            StartSecureZK();
            CuratorService curator = null;
            LoginContext   login   = Login(ZookeeperLocalhost, ZookeeperClientContext, keytab_zk);

            try
            {
                LogLoginDetails(Zookeeper, login);
                RegistrySecurity.SetZKSaslClientProperties(Zookeeper, ZookeeperClientContext);
                curator = StartCuratorServiceInstance("ZK", true);
                Log.Info(curator.ToString());
                AddToTeardown(curator);
                curator.ZkMkPath("/", CreateMode.Persistent, false, RegistrySecurity.WorldReadWriteACL
                                 );
                curator.ZkList("/");
                curator.ZkMkPath("/zookeeper", CreateMode.Persistent, false, RegistrySecurity.WorldReadWriteACL
                                 );
            }
            finally
            {
                Logout(login);
                ServiceOperations.Stop(curator);
            }
        }
示例#2
0
        public virtual void TestUseZKServiceForBinding()
        {
            CuratorService cs2 = new CuratorService("curator", zookeeper);

            cs2.Init(new Configuration());
            cs2.Start();
        }
示例#3
0
 /// <summary>Create an instance</summary>
 /// <exception cref="System.IO.IOException"/>
 protected internal virtual void CreateCuratorService()
 {
     curatorService = new CuratorService("curatorService");
     curatorService.Init(CreateRegistryConfiguration());
     curatorService.Start();
     rootACL = RegistrySecurity.WorldReadWriteACL;
     curatorService.MaybeCreate(string.Empty, CreateMode.Persistent, rootACL, true);
 }
示例#4
0
        public virtual void TestInsecureClientToZK()
        {
            StartSecureZK();
            UserZookeeperToCreateRoot();
            RegistrySecurity.ClearZKSaslClientProperties();
            CuratorService curatorService = StartCuratorServiceInstance("insecure client", false
                                                                        );

            curatorService.ZkList("/");
            curatorService.ZkMkPath(string.Empty, CreateMode.Persistent, false, RegistrySecurity
                                    .WorldReadWriteACL);
        }
示例#5
0
        /// <summary>Start a curator service instance</summary>
        /// <param name="name">name</param>
        /// <param name="secure">flag to indicate the cluster is secure</param>
        /// <returns>an inited and started curator service</returns>
        protected internal virtual CuratorService StartCuratorServiceInstance(string name
                                                                              , bool secure)
        {
            Configuration clientConf = new Configuration();

            clientConf.Set(KeyRegistryZkRoot, "/");
            clientConf.SetBoolean(KeyRegistrySecure, secure);
            Describe(Log, "Starting Curator service");
            CuratorService curatorService = new CuratorService(name, secureZK);

            curatorService.Init(clientConf);
            curatorService.Start();
            Log.Info("Curator Binding {}", curatorService.BindingDiagnosticDetails());
            return(curatorService);
        }