当前位置: 首页>>代码示例>>C#>>正文


C# HBaseClient.ListTables方法代码示例

本文整理汇总了C#中HBaseClient.ListTables方法的典型用法代码示例。如果您正苦于以下问题:C# HBaseClient.ListTables方法的具体用法?C# HBaseClient.ListTables怎么用?C# HBaseClient.ListTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HBaseClient的用法示例。


在下文中一共展示了HBaseClient.ListTables方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HBaseWriter

 public HBaseWriter()
 {
     //Get the Hadoop Cluster info and create connection
     this.ClusterName = ConfigurationManager.AppSettings["ClusterName"];
     this.HadoopUserName = ConfigurationManager.AppSettings["HadoopUserName"];
     string HadoopUserPassword = ConfigurationManager.AppSettings["HadoopUserPassword"];
     this.HBaseTableName = ConfigurationManager.AppSettings["HBaseTableName"];
     SecureString pw = new SecureString();
     for(int i = 0; i < HadoopUserPassword.Length; i++){
         pw.InsertAt(i, HadoopUserPassword[i]);
     }
     Uri clusterUri = new Uri(this.ClusterName);
     ClusterCredentials creds = new ClusterCredentials(clusterUri, this.HadoopUserName, pw);
     this.client = new HBaseClient(creds);
     //create table and enable the hbase writer
     if (!client.ListTables().name.Contains(this.HBaseTableName))
     {
         // Create the table
         var tableSchema = new TableSchema();
         tableSchema.name = this.HBaseTableName;
         tableSchema.columns.Add(new ColumnSchema { name = "d" });
         client.CreateTable(tableSchema);
         Console.WriteLine("Table \"{0}\" created.", this.HBaseTableName);
     }
     WriterThread = new Thread(new ThreadStart(WriterThreadFunction));
     WriterThread.Start();
 }
开发者ID:anytimecnc,项目名称:ProjectTeddy,代码行数:27,代码来源:HBaseWriter.cs

示例2: Context

        protected override void Context()
        {
            if (!_arrangementCompleted)
            {
                // at present, no tables are modified so only arrange the tables once per test pass
                // and putting the arrangement into a static context.
                // (this knocked test runs down to ~30 seconds from ~5 minutes).

                _credentials = ClusterCredentialsFactory.CreateFromFile(@".\credentials.txt");
                var client = new HBaseClient(_credentials);

                // ensure tables from previous tests are cleaned up
                TableList tables = client.ListTables();
                foreach (string name in tables.name)
                {
                    string pinnedName = name;
                    if (name.StartsWith(TableNamePrefix, StringComparison.Ordinal))
                    {
                        client.DeleteTable(pinnedName);
                    }
                }

                AddTable();
                PopulateTable();

                _arrangementCompleted = true;
            }
        }
开发者ID:gitter-badger,项目名称:hbase-sdk-for-net,代码行数:28,代码来源:FilterTests.cs

示例3: EventHBaseWriter

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="tablename"></param>
        public EventHBaseWriter(Context context, Dictionary<string, Object> parms = null)
        {
            this.context = context;

            this.appConfig = new AppConfig();

            Dictionary<string, List<Type>> inputSchema = new Dictionary<string, List<Type>>();
            inputSchema.Add(Constants.DEFAULT_STREAM_ID, AggregatedTupleFields);

            this.context.DeclareComponentSchema(new ComponentStreamSchema(inputSchema, null));

            //Setup the credentials for HBase cluster
            HBaseClusterCredentials = 
                new ClusterCredentials(
                    new Uri(this.appConfig.HBaseClusterUrl), 
                    this.appConfig.HBaseClusterUserName, 
                    this.appConfig.HBaseClusterUserPassword);

            HBaseClusterClient = new HBaseClient(HBaseClusterCredentials);

            //Query HBase for existing tables
            var tabs = HBaseClusterClient.ListTables();
            Context.Logger.Info("HBase Tables (" + tabs.name.Count + "): " + String.Join(", ", tabs.name));

            this.PrimaryKey = this.appConfig.PrimaryKey;
            this.SecondaryKey = this.appConfig.SecondaryKey;

            this.HBaseTableName =
                this.appConfig.HBaseTableNamePrefix +
                this.appConfig.PrimaryKey + this.appConfig.SecondaryKey +
                this.appConfig.HBaseTableNameSuffix;

            Context.Logger.Info("HBaseTableName = " + this.HBaseTableName);

            //Create a HBase table if it not exists
            if (!tabs.name.Contains(this.HBaseTableName))
            {
                var tableSchema = new TableSchema();
                tableSchema.name = this.HBaseTableName;
                tableSchema.columns.Add(new ColumnSchema() { name = "v" });
                HBaseClusterClient.CreateTable(tableSchema);
                Context.Logger.Info("Created HBase Table: " + this.HBaseTableName);
            }

            Context.Logger.Info("HBaseOverwrite: " + this.appConfig.HBaseOverwrite);

            globalstopwatch = new Stopwatch();
            globalstopwatch.Start();

            emitstopwatch = new Stopwatch();
            emitstopwatch.Start();
        }
开发者ID:cleydson,项目名称:hdinsight-storm-examples,代码行数:57,代码来源:EventHBaseWriter.cs

示例4: HBaseStore

        public HBaseStore()
        {
            // Initialize HBase connection
            var credentials = CreateFromFile(@"credentials.txt");
            client = new HBaseClient(credentials);

            if (!client.ListTables().name.Contains(TABLE_BY_WORDS_NAME))
            {
                // Create the table
                var tableSchema = new TableSchema();
                tableSchema.name = TABLE_BY_WORDS_NAME;
                tableSchema.columns.Add(new ColumnSchema { name = "d" });
                client.CreateTable(tableSchema);
            }
        }
开发者ID:mkellerman,项目名称:tweet-sentiment,代码行数:15,代码来源:HBaseStore.cs

示例5: Context

        protected override void Context()
        {
            _credentials = ClusterCredentialsFactory.CreateFromFile(@".\credentials.txt");
            var client = new HBaseClient(_credentials);

            // ensure tables from previous tests are cleaned up
            
            TableList tables = client.ListTables();
            foreach (string name in tables.name)
            {
                if (name.StartsWith(TestTablePrefix, StringComparison.Ordinal))
                {
                    client.DeleteTable(name);
                }
            }

            // add a table specific to this test
            _testTableName = TestTablePrefix + _random.Next(10000);
            _testTableSchema = new TableSchema();
            _testTableSchema.name = _testTableName;
            _testTableSchema.columns.Add(new ColumnSchema { name = "d" });
           
            client.CreateTable(_testTableSchema);
        }
开发者ID:gitter-badger,项目名称:hbase-sdk-for-net,代码行数:24,代码来源:HBaseClientTests.cs

示例6: HBaseWriter

        public HBaseWriter()
        {
            var credentials = CreateFromFile(@"..\..\credentials.txt");
            client = new HBaseClient(credentials);

            if (!client.ListTables().name.Contains(TABLE_BY_WORDS_NAME))
            {
                // Create the table
                var tableSchema = new TableSchema();
                tableSchema.name = TABLE_BY_WORDS_NAME;
                tableSchema.columns.Add(new ColumnSchema { name = "d" });
                client.CreateTable(tableSchema);
                Console.WriteLine("Table \"{0}\" created.", TABLE_BY_WORDS_NAME);
            }

            // Read current row count cell
            rowCount = GetRowCount();

            // Load sentiment dictionary file
            LoadDictionary();

            writerThread = new Thread(new ThreadStart(WriterThreadFunction));
            writerThread.Start();
        }
开发者ID:mkellerman,项目名称:tweet-sentiment,代码行数:24,代码来源:HBaseWriter.cs

示例7: TestListTables

        public void TestListTables()
        {
            var client = new HBaseClient(_credentials);

            TableList tables = client.ListTables();
            List<string> testtables = tables.name.Where(item => item.StartsWith("marlintest", StringComparison.Ordinal)).ToList();
            Assert.AreEqual(1, testtables.Count);
            Assert.AreEqual(_testTableName, testtables[0]);
        }
开发者ID:gitter-badger,项目名称:hbase-sdk-for-net,代码行数:9,代码来源:HBaseClientTests.cs

示例8: HBaseWriter

        // This function connects to HBase, loads the sentiment dictionary, and starts the thread for writting.
        public HBaseWriter()
        {
            ClusterCredentials credentials = new ClusterCredentials(new Uri(CLUSTERNAME), HADOOPUSERNAME, HADOOPUSERPASSWORD);
            client = new HBaseClient(credentials);

            // create the HBase table if it doesn't exist
            if (!client.ListTables().name.Contains(HBASETABLENAME))
            {
                TableSchema tableSchema = new TableSchema();
                tableSchema.name = HBASETABLENAME;
                tableSchema.columns.Add(new ColumnSchema { name = "d" });
                client.CreateTable(tableSchema);
                Console.WriteLine("Table \"{0}\" is created.", HBASETABLENAME);
            }

            // Load sentiment dictionary from a file
            LoadDictionary();

            // Start a thread for writting to HBase
            writerThread = new Thread(new ThreadStart(WriterThreadFunction));
            writerThread.Start();
        }
开发者ID:datasciencedojo,项目名称:TwitterHBaseLab,代码行数:23,代码来源:HBaseWriter.cs


注:本文中的HBaseClient.ListTables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。