Why zookeeper in hbase




















But, along with all these advantages of HBase you should keep this in mind that random read-write is quick but always has additional overhead. So think well before ye make any decision. ZooKeeper is a high-performance coordination service for distributed applications like HBase. It exposes common services like naming, configuration management, synchronization, and group services , in a simple interface so you don't have to write them from scratch. You can use it off-the-shelf to implement consensus, group management, leader election, and presence protocols.

And you can build on it for your own, specific needs. HBase relies completely on Zookeeper. HBase provides you the option to use its built-in Zookeeper which will get started whenever you start HBAse.

But it is not good if you are working on a production cluster. In such scenarios it's always good to have a dedicated Zookeeper cluster and integrate it with your HBase cluster. Zookeeper : In short, zookeeper is a distributed application cluster configuration and management tool, and it exits independent of HBase.

From the docs:. ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications.

Each time they are implemented there is a lot of work that goes into fixing the bugs and race conditions that are inevitable. Because of the difficulty of implementing these kinds of services, applications initially usually skimp on them ,which make them brittle in the presence of change and difficult to manage. Even when done correctly, different implementations of these services lead to management complexity when the applications are deployed. HBase contains two primary services:. Interface of the source that will export metrics about the ZooKeeper.

A ZooKeeper watcher meant to detect deletions of ZNodes. Manages the location of the current active Master for the RegionServer. Class that transitions metrics from MetricsZooKeeper into the metrics subsystem. A very simple read only zookeeper implementation without watcher support.

Set this property to a higher value than hbase. Maximum retries. Retry interval is a rough function based on hbase. At first we retry at this interval but then with backoff, we pretty quickly reach retrying every ten seconds. Change this setting and hbase. The maximum number of concurrent mutation tasks a single HTable instance will send to the cluster. The maximum number of concurrent mutation tasks a single HTable instance will send to a single region server.

The maximum number of concurrent mutation tasks the client will maintain to a single Region. That is, if there is already hbase. The max number of concurrent pending requests for one server in all client threads process level.

If you use a fix number of threads to access HBase in a synchronous way, set this to a suitable value which is related to the number of threads will help you. Number of rows that we try to fetch when calling next on a scanner if it is not served from local, client memory. This configuration works together with hbase. The default value is Integer.

If you know ahead of time that you will not require more than a certain number of rows from a scan, this configuration should be set to that row limit via Scan setCaching. Higher caching values will enable faster scanners but will eat up more memory and some calls of next may take longer and longer times when the cache is empty.

Do not set this value such that the time between invocations is greater than the scanner timeout; i. Specifies the combined maximum allowed size of a KeyValue instance. This is to set an upper boundary for a single entry saved in a storage file.

Since they cannot be split it helps avoiding that a region cannot be split any further because the data is too large. It seems wise to set this to a fraction of the maximum region size. Setting it to zero or less disables the check. Maximum allowed size of an individual cell, inclusive of value and all key components. A value of 0 or less disables the check. The default value is 10MB. This is a safety setting to protect the server from OOM situations.

This is maximum number of iterations to atomic bulk loads are attempted in the face of splitting operations 0 means never give up. Request Compaction after bulkload immediately. If bulkload is continuous, the triggered compactions may increase load, bring about performance side effect. The max percent of regions in transition when balancing. The default value is 1. So there are no balancer throttling.

If set this config to 0. The default value of this parameter is 0. This config is used to set default behaviour of normalizer at table level. In master side, this config is the period used for FS related behaviors: checking if hdfs is out of safe mode, setting or checking hbase. Using default value should be fine. In regionserver side, this config is used in several places: flushing check interval, compaction check interval, wal rolling check interval. Specially, admin can tune flushing and compaction check interval by hbase.

It determines the flushing check period of PeriodicFlusher in regionserver. If unset, it uses hbase. It determines the compaction check period of CompactionChecker in regionserver. How many times to retry attempting to write a version file before just aborting.

Each attempt is separated by the hbase. Memstore will be flushed to disk if size of the memstore exceeds this number of bytes. Value is checked by a thread that runs every hbase. If FlushLargeStoresPolicy is used and there are multiple column families, then every time that we hit the total memstore limit, we find out all the column families whose memstores exceed a "lower bound" and only flush them while retaining the others in memory.

The "lower bound" will be "hbase. If none of the families have their memstore size more than lower bound, all the memstores will be flushed just as usual.

If the memstores in a region are this size or larger when we go to close, run a "pre-flush" to clear out memstores before we put up the region closed flag and take the region offline.

On close, a flush is run under the close flag to empty memory. During this time the region is offline and we are not taking on any writes. If the memstore content is large, this flush could take a long time to complete. The preflush is meant to clean out the bulk of the memstore before putting up the close flag and taking the region offline so the flush that runs under the close flag has little to do.

Block updates if memstore has hbase. Useful preventing runaway memstore during spikes in update traffic. Without an upper-bound, memstore fills such that when it flushes the resultant flush files take a long time to compact or split, or worse, we OOME. Enables the MemStore-Local Allocation Buffer, a feature which works to prevent heap fragmentation under heavy write loads.

This can reduce the frequency of stop-the-world GC pauses on large heaps. The amount of off-heap memory all MemStores in a RegionServer may use. Unit: megabytes.

Maximum file size. Time between major compactions, expressed in milliseconds. Set to 0 to disable time-based automatic major compactions. User-requested and size-based major compactions will still run. This value is multiplied by hbase. The default value is 7 days, expressed in milliseconds. If major compactions are causing disruption in your environment, you can configure them to run at off-peak times for your deployment, or disable time-based major compactions by setting this parameter to 0, and run major compactions in a cron job or by another external mechanism.

A multiplier applied to hbase. The smaller the number, the closer the compactions will happen to the hbase. Larger values delay compaction, but when compaction does occur, it takes longer to complete.

The number of flush threads. With fewer threads, the MemStore flushes will be queued. With more threads, the flushes will be executed in parallel, increasing the load on HDFS, and potentially causing more compactions. If more than this number of StoreFiles exist in any one Store one StoreFile is written per flush of MemStore , updates are blocked for this region until a compaction is completed, or until hbase.

The time for which a region will block updates after reaching the StoreFile limit defined by hbase. After this time has elapsed, the region will stop blocking updates even if a compaction has not been completed. The minimum number of StoreFiles which must be eligible for compaction before compaction can run. The goal of tuning hbase.

Setting this value to 2 would cause a minor compaction each time you have two StoreFiles in a Store, and this is probably not appropriate. If you set this value too high, all the other values will need to be adjusted accordingly.

For most cases, the default value is appropriate empty value here, results in 3 by code logic. In previous versions of HBase, the parameter hbase. The maximum number of StoreFiles which will be selected for a single minor compaction, regardless of the number of eligible StoreFiles.

Effectively, the value of hbase. Setting it larger means that more StoreFiles are included in a compaction. For most cases, the default value is appropriate. A StoreFile or a selection of StoreFiles, when using ExploringCompactionPolicy smaller than this size will always be eligible for minor compaction.

HFiles this size or larger are evaluated by hbase. Because this limit represents the "automatic include" limit for all StoreFiles smaller than this value, this value may need to be reduced in write-heavy environments where many StoreFiles in the MB range are being flushed, because every StoreFile will be targeted for compaction and the resulting StoreFiles may still be under the minimum size and require further compaction. If this parameter is lowered, the ratio check is triggered more quickly.

This addressed some issues seen in earlier versions of HBase but changing this parameter is no longer necessary in most situations. Default: MB expressed in bytes. The effect of raising hbase. If you feel that compaction is happening too often without much benefit, you can try raising this value.

Default: the value of LONG. For minor compaction, this ratio is used to determine whether a given StoreFile which is larger than hbase. Its effect is to limit compaction of large StoreFiles. The value of hbase. A large ratio, such as 10, will produce a single giant StoreFile. Conversely, a low value, such as.

A moderate value of between 1. When tuning this value, you are balancing write costs with read costs. Raising the value to something like 1. However, during reads, HBase will need to seek through fewer StoreFiles to accomplish the read. Consider this approach if you cannot take advantage of Bloom filters. Otherwise, you can lower this value to something like 1. Allows you to set a different by default, more aggressive ratio for determining whether larger StoreFiles are included in compactions during off-peak hours.

Works in the same way as hbase. Only applies if hbase. The amount of time to delay purging of delete markers with future timestamps. If unset, or set to 0, all delete markers, including those with future timestamps, are purged during the next major compaction. The start of off-peak hours, expressed as an integer between 0 and 23, inclusive.

Set to -1 to disable off-peak. The end of off-peak hours, expressed as an integer between 0 and 23, inclusive. There are two different thread pools for compactions, one for large compactions and the other for small compactions.

This helps to keep compaction of lean tables such as hbase:meta fast. If a compaction is larger than this threshold, it goes into the large compaction pool. In most cases, the default value is appropriate. Default: 2 x hbase. The value field assumes that the value of hbase. Setting it to true helps prevent minor compactions from polluting the page cache, which is most beneficial on clusters with low memory to storage ratio or very write heavy clusters.

You may want to set it to false under moderate to low write workload when bulk of the reads are on the most recently written data. The maximum number of KeyValues to read and then write in a batch when flushing or compacting. Enables StoreFileScanner parallel-seeking in StoreScanner, a feature which can reduce response latency under special conditions.

Percentage of maximum heap -Xmx setting to allocate to block cache used by a StoreFile. Default of 0. This allows to put non-root multi-level index blocks into the block cache at the time the index is being written. When the size of a leaf-level, intermediate-level, or root-level index block in a multi-level block index grows to this size, the block is written out and a new block is started.

Where to store the contents of the bucketcache. One of: offheap, file, files, mmap or pmem. Allows you to tune the minimum available compaction throughput when the PressureAwareCompactionThroughputController throughput controller is active. It is active by default. Allows you to control aggregate compaction throughput demand when the PressureAwareCompactionThroughputController throughput controller is active.

The maximum throughput will be tuned between the lower and upper bounds when compaction pressure is within the range [0. If compaction pressure is 1. A comma-separated list of sizes for buckets for the bucketcache. Can be multiple sizes. List block sizes in order from smallest to largest.

The sizes you use will depend on your data access patterns. Must be a multiple of else you will run into 'java. The HFile format version to use for new files. Also see the configuration 'hbase. The size in bytes of a single block "chunk" of a compound Bloom filter. This size is approximate, because Bloom blocks can only be inserted at data block boundaries, and the number of keys per data block varies.

This is for the RPC layer to define how long millisecond HBase client applications take for a remote call to time out. It uses pings to check connections but will eventually throw a TimeoutException. Operation timeout is a top-level restriction millisecond that makes sure a blocking operation in Table will not be blocked more than this.

In each operation, if rpc request fails because of timeout or other reason, it will retry until success or throw RetriesExhaustedException. But if the total time being blocking reach the operation timeout before retries exhausted, it will break early and throw SocketTimeoutException. The number of cells scanned in between heartbeat checks.

Heartbeat checks occur during the processing of scans to determine whether or not the server should stop scanning in order to send back a heartbeat message to the client.

Heartbeat messages are used to keep the client-server connection alive during long running scans. Small values mean that the heartbeat checks will occur more often and thus will provide a tighter bound on the execution time of the scan. Larger values mean that the heartbeat checks occur less frequently.

This is another version of "hbase. For those RPC operation within cluster, we rely on this configuration to set a short timeout limitation for short operation. Set no delay on rpc socket connections. When set to a non-empty value, this represents the external facing hostname for the underlying server. When set to true, regionserver will use the current node hostname for the servername and HMaster will skip reverse DNS lookup and use the hostname sent by regionserver instead.

Note that this config and hbase. Full path to the kerberos keytab file to use for logging in the configured HMaster server principal. The kerberos principal name that should be used to run the HMaster process. Full path to the kerberos keytab file to use for logging in the configured HRegionServer server principal.

The kerberos principal name that should be used to run the HRegionServer process. An entry for this principal must exist in the file specified in hbase. The policy configuration file used by RPC servers to make authorization decisions on client requests. Only used when HBase security is enabled.

List of users or groups comma-separated , who are allowed full privileges, regardless of stored ACLs, across the cluster. The update interval for master key for authentication tokens in servers in milliseconds. The maximum lifetime in milliseconds after which an authentication token expires. When a client is configured to attempt a secure connection, but attempts to connect to an insecure server, that server may instruct the client to switch to SASL SIMPLE unsecure authentication.

This setting controls whether or not the client will accept this instruction from the server. When false the default , the client will not allow the fallback to SIMPLE authentication, and will abort the connection. When false the default , the server will not allow the fallback to SIMPLE authentication, and will reject the connection. When this is set to false, the keys are hidden.

Enables or disables coprocessor loading. If 'false' disabled , any other coprocessor related configuration will be ignored. Enables or disables user aka. If 'false' disabled , any table coprocessor attributes in table descriptors will be ignored. If "hbase. A comma-separated list of region observer or endpoint coprocessors that are loaded by default on all tables.

For any override coprocessor method, these classes will be called in order. A comma-separated list of org. MasterObserver coprocessors that are loaded by default on the active HMaster process. For any implemented coprocessor methods, the listed classes will be called in order.

Set to true to cause the hosting server master or regionserver to abort if a coprocessor fails to load, fails to initialize, or throws an unexpected Throwable object. Setting this to false will allow the server to continue execution but the system wide state of the coprocessor in question will become inconsistent as it will be properly executing in only a subset of servers, so this is most useful for debugging only. Defines the mode the REST server will be started in. The maximum number of threads of the REST server thread pool.

Threads in the pool are reused to process REST requests. This controls the maximum number of requests processed concurrently. If the thread pool is full, incoming requests will be queued up and wait for some free threads. The minimum number of threads of the REST server thread pool. The thread pool always has at least these number of threads so the REST server is ready to serve incoming requests.

Set to true to skip the 'hbase. Setting this to true can be useful in contexts other than the other side of a maven generation; i.

Set to true to enable locking the table in zookeeper for schema change operations. Table locking from master prevents concurrent schema modifications to corrupt table state. If row size exceeds this limit RowTooBigException is thrown to client. The "core size" of the thread pool. New threads are created on every connection until this many threads are created.

The maximum size of the thread pool. When the pending request queue overflows, new threads are created until their number reaches this number.

After that, the server starts dropping connections. The maximum number of pending Thrift connections waiting in the queue. If there are no idle threads in the pool, the server queues requests. Only when the queue overflows, new threads are added, up to hbase. Use Thrift TFramedTransport on the server side. This is the recommended transport for thrift servers and requires a similar setting on the client side. FS Permissions for the root data subdirectory in a secure kerberos setup.

When master starts, it creates the rootdir with this permissions or sets the permissions if it does not match. When master starts, it creates the WAL dir with this permissions or sets the permissions if it does not match. Enable, if true, that file permissions should be assigned to the files written by the regionserver. Set to true to take a snapshot before the restore operation.

The snapshot taken will be used in case of failure, to restore the previous state. At the end of the restore operation this snapshot will be deleted. Name of the failsafe snapshot taken by the restore operation. Location where the snapshotting process will occur. The location of the completed snapshots will not change, but the temporary directory where the snapshot process occurs will be set to this location. This can be a separate filesystem than the root directory, for performance increase purposes.

The number that determines how often we scan to see if compaction is necessary. The interval between checks is hbase. How long between dfs recover lease invocations. Should be larger than the sum of the time it takes for the namenode to issue a block recovery command as part of datanode; dfs. Be careful about permissions for the directory that hosts the shared domain socket; dfsclient will complain if open to other users than the HBase user.

If the DFSClient configuration dfs. So, we set it down from the default. If set to true the default , HBase verifies the checksums for hfile blocks. HBase writes checksums inline with the data when it writes out hfiles.

HDFS as of this writing writes checksums to a separate file than the data file necessitating extra seeks. Checksum verification by HDFS will be internally disabled on hfile streams when this flag is set. And besides this feature applies to hfiles only, not to WALs. If this parameter is set to false, then hbase will not verify any checksums, instead it will depend on checksum verification being done in the HDFS client.

Note that when a single row is larger than this limit the row is still returned completely. The default value is 2MB, which is good for 1ge networks. The default value is MB.

This setting activates the publication by the master of the status of the region server. When a region server dies and its recovery starts, the master will push this information to the client application, to let them cut the connection immediately instead of waiting for a timeout.

The directory from which the custom filter JARs can be loaded dynamically by the region server without the need to restart. Does not apply to coprocessors. Controls whether or not secure authentication is enabled for HBase. Possible values are 'simple' no authentication , and 'kerberos'. Class used to execute the regions balancing when the period occurs. Class used to execute the region normalization when the period occurs.

If the incoming User-Agent matches any of these regular expressions, then the request is considered to be sent by a browser, and therefore CSRF prevention is enforced. In this case, CSRF is not a potential attack vector, so the prevention is not enforced. This helps achieve backwards-compatibility with existing automation that has not been updated to send the CSRF prevention header.

If this setting is enabled and ACL based access control is active the AccessController coprocessor is installed either as a system coprocessor or on a table as a table coprocessor then you must grant all relevant users EXEC privilege if they require the ability to execute coprocessor endpoint calls.

EXEC privilege, like any other permission, can be granted globally to a user, or to a user on a per table or per namespace basis. You need to have a working Kerberos KDC setup. For each such host, add a service key using the kadmin or kadmin. For each host, add a keytab file called hbase. Each user who will be an HBase client should also be given a Kerberos principal.

This principal should usually have a password assigned to it as opposed to, as with the HBase servers, a keytab file which only this user knows. The client's principal's maxrenewlife should be set so that it can be renewed enough so that the user can complete their HBase client processes.

For example, if a user runs a long-running HBase client process that takes at most 3 days, we might create this user's principal within kadmin with: addprinc -maxrenewlife 3days. The Zookeeper client and server libraries manage their own ticket refreshment by running threads that wake up periodically to do the refreshment. On each host that will run an HBase client e. The Server section will be used by the Zookeeper quorum server, while the Client section will be used by the HBase master and regionservers.

Modify your hbase-site. Start your hbase cluster by running one or more of the following set of commands on the appropriate hosts:. Put this in the HBase home's configuration directory. Add a zoo. Start your HBase cluster by running one or more of the following set of commands on the appropriate nodes:.



0コメント

  • 1000 / 1000