In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to change the table name in hbase. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Hbase modifies the table name
There is no direct api for hbase to modify the table name. If we want to change the table name, we can use the snapshot method.
To enable the snapshot feature, add the following configuration items to the hbase-site.xml file:
Hbase.snapshot.enabled
True
Command
Hbase shell > disable 'tableName'
Hbase shell > snapshot 'tableName',' tableSnapshot'
Hbase shell > clone_snapshot 'tableSnapshot',' newTableName'
Then we can test whether the new table is successful.
What is a snapshot?
A snapshot is a collection of meta-information that allows the administrator to revert to the previous state of the table. A snapshot is not a copy of a table, but a list of file names, so the data is not replicated. Full snapshot restore refers to the restore to the previous "table structure" and the data at that time, and the data that occurs after the snapshot will not be restored.
Operation
Generate Snapshot: this operation attempts to generate a snapshot of the specified table. If the cluster performs operations such as data equalization, separation, or merge, it may cause the operation to fail.
Clone snapshot: this operation builds a new table using the same structured data as the specified snapshot. The result of the operation is a fully functional table, and any changes to the table will not affect the original table or snapshot.
Restore snapshot: this operation restores the table structure and data to the state it was in when the snapshot was taken. (note: this operation discards any changes after the snapshot is generated.)
Delete Snapshot: this operation deletes snapshots in the system, frees up unshared disk space, and does not affect other clones or snapshots.
Export snapshot: this operation copies snapshot data and metadata to other clusters. The operation only involves HDFS and does not have any contact with Master or domain servers, so the HBase cluster can be shut down.
Zero replication snapshot, restore, clone
The main difference between snapshots and copy / export tables is that snapshot operations only write metadata and do not involve large amounts of data.
One of the main design principles of HBase is that once the file is written, it will not be modified. The immutability of the file means that the snapshot only needs to keep track of the file that existed when the snapshot was generated, and is responsible for reminding the system that the file should not be deleted but should be archived during compression.
The same principle applies to clone and restore operations. Because the file is immutable, you can create a new table simply by "linking" to the file reference through the snapshot.
Exporting snapshots is the only operation that needs to copy data because other clusters do not have data files.
Export snapshot vs replication / export table
In addition to better consistency between exported snapshots and replication / export tables, the main difference is that exported snapshots operate at the HDFS level. This means that the Master and domain servers are independent of the operation. Therefore, there is no need to create cache space for unnecessary data, and there will be no GC pauses caused by the scanning process due to the creation of a large number of objects. The main performance impact for HBase is the additional network and disk load of DataNode.
HBase command: snapshot operation
Confirm that the snapshot license is turned on by checking that hbase.snapshot.enabled in hbase-site.xml is set to true. Take a snapshot of the specified table using the snapshot command (does not produce file replication)
Hbase > snapshot 'tableName',' snapshotName'
List all snapshots, using the list_snapshot command. Displays the snapshot name, source table, and creation date and time
Hbase > list_snapshots
Use the clone_snapshot command to generate a new table (clone) from the specified snapshot. Since there will be no data replication, the final data will not be used twice as much as before.
Hbase > clone_snapshot 'snapshotName',' newTableName'
Use the restore_snapshot command to replace the current table structure / data with the specified snapshot contents.
To restore data with a snapshot, it needs to disable the table before restoring
Hbase > disable 'myTable' hbase > restore_snapshot' snapshotName'
Delete a snapshot using the deleted_snapshot command. Deleting a snapshot does not affect the clone table or subsequent snapshots.
Hbase > delete_snapshot 'snapshotName'
Use the ExportSnapshot tool to export an existing snapshot to another cluster. The export utility does not affect the domain server load, but only works at the HDFS level, so you need to specify the HDFS path (the hbase root directory of other clusters)
Use 16 mappers to copy a snapshot named MySnapshot to a cluster called hbfreeoa2
Hbase class org.apache.hadoop.hbase.snapshot.ExportSnapshot-snapshot MySnapshot-copy-to hdfs://hbfreeoa2:8020/hbase-mappers 16
After reading the above, do you have any further understanding of how to change the table name in hbase? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.