Bu sayfa henüz yerel dilinizde mevcut değildir. Daha fazla dil seçeneği eklemek için yoğun bir şekilde çalışıyoruz. Desteğiniz için teşekkür ederiz.
CloudTable Service
CloudTable Service
- Service Overview
- Billing
- Getting Started
-
User Guide
-
HBase User Guide
-
HBase Cluster Management
- Overview
- Managing Clusters
- Preparing an ECS
- Using HBase
- HBase Cold and Hot Data Separation
- HBase Thrift Server
- HBase Security Channel Encryption
- HBase Batch Data Import
- HBase Monitoring Clusters
- Self-Healing from HBase Hotspotting
- Global Secondary Indexes
-
HBase Cluster Management
-
ClickHouse User Guide
-
ClickHouse Cluster Management
- Overview
- Managing ClickHouse Clusters
- Using ClickHouse
- Migrating ClickHouse Data
- ClickHouse User Management
- ClickHouse Role Management
- ClickHouse Slow Query Management
- Configuring Secure Channel Encryption for ClickHouse Clusters
- Application of ClickHouse Cold and Hot Data Separation
- ClickHouse Monitoring Clusters
-
ClickHouse Cluster Management
- Permissions Management
- Audit Logs
- Cluster Log Management
-
HBase User Guide
-
Developer Guide
- HBase Application Development Guide
- ClickHouse Application Development Guide
-
FAQs
-
General
- What Services Does a CloudTable Cluster Provide?
- Why Do I Choose CloudTable Service?
- How Do I Prepare for Creating a CloudTable HBase Cluster?
- What Should I Pay Attention to When Using CloudTable Service?
- What Compression Algorithms Are Supported by CloudTable HBase Clusters?
- Can I Stop CloudTable Service?
- Which Programming Languages Are Supported by HBase External APIs in CloudTable?
- How Do I Determine the Number of Faulty RegionServers?
- What Special Characters Does CloudTable HBase Support?
- What Can I Do If the Index Table Does Not Match the Data Table After CloudTable Data Is Deleted?
- What Should I Do If Concurrent Tasks Run Slowly When Python Accesses CloudTable Through Thrift?
- How do I view the TTL attribute of HBase shell?
- Why Are My Server Resources Released?
- How Do I Delete a Cluster?
- How Do I Stop Services and Release Resources?
-
Connection and Access
- How Do I Access a CloudTable Cluster?
- Can I Use SSH to Access Computing Nodes of CloudTable?
- Why Can't I Access HBase After the ZK Address Is Configured?
- Why Is the Error "Will not attempt to authenticate using SASL (unknown error)" Reported When Connecting to HBase?
- How Do I View the IP Address Corresponding to a Domain Name in a CloudTable Link?
- How Do I Access CloudTable from Other Cloud Services?
- Can I Configure the hbase-site.xml File?
- How Do I Query the Creation Time of a Table in CloudTable HBase?
-
Data Read/Write
- Is Raw Data Stored in CloudTable HBase?
- Why Can't I Write Data to HBase?
- What Is the Maximum Size of Data Written to the HBase Cluster?
- How Do I Check the Daily Incremental Data in HBase Tables?
- What Should I Do If an Error Is Reported When I Access the CloudTable HBase Cluster?
- How Do I Delete the Backup Table of the ZooKeeper Node in the ClickHouse Cluster?
- What Should I Do If a Database Missing Error Occurs When a Table Is Created in the ClickHouse Cluster?
- Billing FAQs
-
General
- General Reference
On this page
Help Center/
CloudTable Service/
Developer Guide/
HBase Application Development Guide/
Developing Term Index Applications/
Sample Code Description/
Enabling a Term Index When Creating a Table
Copied.
Enabling a Term Index When Creating a Table
Function Description
Follow instructions in Creating a Table to create a table. In addition, configure a term index schema in table properties.
Sample Code
public void testCreateTable() { LOG.info("Entering testCreateTable."); HTableDescriptor tableDesc = new HTableDescriptor(tableName); HColumnDescriptor cdm = new HColumnDescriptor(FAM_M); cdm.setDataBlockEncoding(DataBlockEncoding.FAST_DIFF); tableDesc.addFamily(cdm); HColumnDescriptor cdn = new HColumnDescriptor(FAM_N); cdn.setDataBlockEncoding(DataBlockEncoding.FAST_DIFF); tableDesc.addFamily(cdn); // Add bitmap index definitions. List<BitmapIndexDescriptor> bitmaps = new ArrayList<>();//(1) bitmaps.add(BitmapIndexDescriptor.builder() // Describe which column should be indexed. .setColumnName(FamilyOnlyName.valueOf(FAM_M))//(2) // Describe how to extract term(s) from KeyValue .setTermExtractor(TermExtractor.NAME_VALUE_EXTRACTOR)//(3) .build()); // It will help to add several properties into HTableDescriptor. // SHARD_NUM should be less than the region number IndexHelper.enableAutoIndex(tableDesc, SHARD_NUM, bitmaps);//(4) List<byte[]> splitList = Arrays.stream(SPLIT.split(LemonConstants.COMMA)) .map(s -> org.lemon.common.Bytes.toBytes(s.trim())) .collect(Collectors.toList()); byte[][] splitArray = splitList.toArray(new byte[splitList.size()][]); Admin admin = null; try { // Instantiate an Admin object. admin = conn.getAdmin(); if (!admin.tableExists(tableName)) { LOG.info("Creating table..."); admin.createTable(tableDesc, splitArray); LOG.info(admin.getClusterStatus()); LOG.info(admin.listNamespaceDescriptors()); LOG.info("Table created successfully."); } else { LOG.warn("table already exists"); } } catch (IOException e) { LOG.error("Create table failed.", e); } finally { if (admin != null) { try { // Close the Admin object. admin.close(); } catch (IOException e) { LOG.error("Failed to close admin ", e); } } } LOG.info("Exiting testCreateTable."); }
Precautions
- (1) BitmapIndexDescriptor describes which fields use what rules to extract terms. One or more BitmapIndexDescriptor can be defined in a data table.
- (2) Defines which columns need to extract terms. The options are as follows:
- ExplicitColumnName: Specifies a column.
- FamilyOnlyName: Indicates all columns in a column family.
- PrefixColumnName: Indicates columns with a specific prefix.
- (3) Defines a rule for extracting terms from columns. The options are as follows:
- QualifierExtractor: Indicates that terms are extracted by column name.
For example, if qualifier is Male and value is 1, the extracted term is Male.
- QualifierValueExtractor: Indicates that terms are extracted by column name and value.
For example, if qualifier is education and value is master, the extracted term is education:master.
- QualifierArrayValueExtractor: Indicates that multiple terms can be extracted. The value is in JSON array format.
For example, if qualifier is hobby and value is ["basketball","football","volleyball"], the extracted terms are as follows:
hobby:basketball hobby:football hobby:volleyball
- QualifierMapValueExtractor: Indicates that multiple terms can be extracted. The value is in JSON map format.
For example, if qualifier is hobby and value is {"basketball":"9","football":"8","volleyball":"7"}, the extracted terms are as follows:
hobby:basketball hobby:football hobby:volleyball hobby:basketball_9 hobby:football_8 hobby:volleyball_7
- QualifierExtractor: Indicates that terms are extracted by column name.
- (4) The number of shards (SHARD_NUM) in the index table must be less than or equal to that in the data table.
Parent topic: Sample Code Description
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot