ZooKeeper Installation

来源:https://ccp.cloudera.com/display/CDHDOC/ZooKeeper+Installation#ZooKeeperInstallation-InstallingtheZooKeeperServerPackage

 

 

Contents

 

Apache ZooKeeper is a highly reliable and available service that provides coordination between distributed processes.

For More Information
From the Apache ZooKeeper site:

"ZooKeeper is a high-performance coordination service for distributed applications. It exposes common services — such as 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."


To learn more about Apache ZooKeeper, visithttp://zookeeper.apache.org/.

Upgrading ZooKeeper to the Latest CDH3 Release

Note
To see which version of ZooKeeper is shipping in the latest CDH3 release, check theVersion and Packaging Information. For important information on new and changed components, see theRelease Notes.

Cloudera recommends that you use arolling upgradeprocess to upgrade ZooKeeper: that is, upgrade one server in the ZooKeeper ensemble at a time. This means bringing down each server in turn, upgrading the software, then restarting the server. The server will automatically rejoin the quorum, update its internal state with the current ZooKeeper leader, and begin serving client sessions.

This method allows you to upgrade ZooKeeper without any interruption in the service, and also lets you monitor the ensemble as the upgrade progresses, and roll back if necessary if you run into problems.

The instructions that follow assume that you are upgrading ZooKeeper as part of an upgrade to the latest CDH3 release, and have already performed the steps underUpgrading CDH3.

Performing a ZooKeeper Rolling Upgrade

Follow these steps to perform a rolling upgrade.

Step 1: Stop the ZooKeeper Server on the First Node

To stop the ZooKeeper server:

$ sudo /sbin/service hadoop-zookeeper-server stop

or

$ sudo /sbin/service hadoop-zookeeper stop

depending on the platform and release.

Warning
Youmustshut down the ZooKeeper. If ZooKeeper is running during the upgrade, the new version will not work correctly.
Step 2: Install the ZooKeeper Base Package on the First Node

SeeInstalling the ZooKeeper Base Package.

Step 3: Install the ZooKeeper Server Package on the First Node

SeeInstalling the ZooKeeper Server Package.

Note
Do not try to start the server yet.
Step 4: Re-enable the Server

Because of a packaging problem in earlier releases, you need to re-enable the server manually after upgrading ZooKeeper from CDH3 Update 1 or earlier to the latest CDH3 release:

$ sudo /sbin/chkconfig --add hadoop-zookeeper-server
Step 5: Restart the Server

SeeInstalling the ZooKeeper Server Packagefor instructions on starting the server.

The upgrade is now complete on this server and you can proceed to the next.

Step 6: Upgrade the Remaining Nodes

Repeat Steps 1-5 above on each of the remaining nodes.

The ZooKeeper upgrade is now complete.

Installing the ZooKeeper Packages

There are two ZooKeeper server packages:

  • Thehadoop-zookeeperbase package provides the basic libraries and scripts that are necessary to run ZooKeeper servers and clients. The documentation is also included in this package.
  • Thehadoop-zookeeper-serverpackage contains theinit.dscripts necessary to run ZooKeeper as a daemon process. Becausehadoop-zookeeper-serverdepends onhadoop-zookeeper, installing the server package automatically installs the base package.
Important
If you have not already done so, install Cloudera'syum,zypper/YaSToraptrepository before using the following commands to install ZooKeeper. For instructions, seeCDH3 Installation.

Installing the ZooKeeper Base Package

To install ZooKeeper on Ubuntu and other Debian systems:

$ sudo apt-get install hadoop-zookeeper


To install ZooKeeper On Red Hat-compatible systems:

$ sudo yum install hadoop-zookeeper


To install ZooKeeper on SUSE systems:

$ sudo zypper install hadoop-zookeeper

Installing the ZooKeeper Server Package and Starting ZooKeeper on a Single Server

The instructions provided here deploy a single ZooKeeper server in "standalone" mode. This is appropriate for evaluation, testing and development purposes, but may not provide sufficient reliability for a production application. SeeInstalling ZooKeeper in a Production Environmentfor more information.

To install a ZooKeeper server on Ubuntu and other Debian systems:

$ sudo apt-get install hadoop-zookeeper-server


To install ZooKeeper On Red Hat-compatible systems:

$ sudo yum install hadoop-zookeeper-server


To install ZooKeeper on SUSE systems:

$ sudo zypper install hadoop-zookeeper-server

To start ZooKeeper

Note
ZooKeeper may start automatically on installation on Ubuntu and other Debian systems.

Use the following command to start ZooKeeper:

$ sudo /sbin/service hadoop-zookeeper-server start

Installing ZooKeeper in a Production Environment

For use in a production environment, you should deploy ZooKeeper as an ensemble with an odd number of nodes. As long as a majority of the servers in the ensemble are available, the ZooKeeper service will be available. The minimum recommended ensemble size is three ZooKeeper servers, and it is recommended that each server run on a separate machine.

ZooKeeper deployment on multiple servers requires a bit of additional configuration. The configuration file (zoo.cfg) on each server must include a list of all servers in the ensemble, and each server must also have amyidfile in its data directory (by default/var/zookeeper) that identifies it as one of the servers in the ensemble.

For instructions describing how to set up a multi-server deployment, seeInstalling a Multi-Server Setup.

Setting up Supervisory Process for the ZooKeeper Server

The ZooKeeper server is designed to be both highly reliable and highly available. This means that:

  • If a ZooKeeper server encounters an error it cannot recover from, it will "fail fast" (the process will exit immediately)
  • When the server shuts down, the ensemble remains active, and continues serving requests
  • Once restarted, the server rejoins the ensemble without any further manual intervention.

Cloudera recommends that you fully automate this process by configuring a supervisory service to manage each server, and restart the ZooKeeper server process automatically if it fails. See theZooKeeper Administrator's Guidefor more information.

Maintaining a ZooKeeper Server

The ZooKeeper server continually saves znode snapshot files and, optionally, transactional logs in a Data Directory to enable you to recover data. It's a good idea to back up the ZooKeeper Data Directory periodically. Although ZooKeeper is highly reliable because a persistent copy is replicated on each server, recovering from backups may be necessary if a catastrophic failure or user error occurs.

The ZooKeeper server does not remove the snapshots and log files, so they will accumulate over time. You will need to cleanup this directory occasionally, based on your backup schedules and processes. To automate the cleanup, azkCleanup.shscript is provided in thebindirectory of thehadoop-zookeeperbase package. Modify this script as necessary for your situation. In general, you want to run this as a cron task based on your backup schedule.

The data directory is specified by thedataDirparameter in the ZooKeeperconfiguration file, and the data log directory is specified by thedataLogDirparameter.

For more information, seeOngoing Data Directory Cleanup.

Viewing the ZooKeeper Documentation

For additional ZooKeeper documentation, seehttp://archive.cloudera.com/cdh/3/zookeeper/.

 

sqoop import --connect jdbc:mysql://zhaosai:3306/mydb --username root --password jqe6b6 --table news --target-dir /user/news --fields-terminated-by “;” --hive-import --hive-table news -m 1出现错误Warning: /opt/programs/sqoop-1.4.7.bin__hadoop-2.6.0/../hbase does not exist! HBase imports will fail. Please set $HBASE_HOME to the root of your HBase installation. Warning: /opt/programs/sqoop-1.4.7.bin__hadoop-2.6.0/../hcatalog does not exist! HCatalog jobs will fail. Please set $HCAT_HOME to the root of your HCatalog installation. Warning: /opt/programs/sqoop-1.4.7.bin__hadoop-2.6.0/../accumulo does not exist! Accumulo imports will fail. Please set $ACCUMULO_HOME to the root of your Accumulo installation. Warning: /opt/programs/sqoop-1.4.7.bin__hadoop-2.6.0/../zookeeper does not exist! Accumulo imports will fail. Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation. 23/06/10 16:18:23 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7 23/06/10 16:18:23 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead. 23/06/10 16:18:23 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset. 23/06/10 16:18:23 INFO tool.CodeGenTool: Beginning code generation Sat Jun 10 16:18:23 CST 2023 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 23/06/10 16:18:24 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM news AS t LIMIT 1 23/06/10 16:18:24 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM news AS t LIMIT 1 23/06/10 16:18:24 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /opt/programs/hadoop-2.7.6 注: /tmp/sqoop-root/compile/84ba419f00fa83cb5d16dba722729d01/news.java使用或覆盖了已过时的 API。 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 23/06/10 16:18:25 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-root/compile/84ba419f00fa83cb5d16dba722729d01/news.jar 23/06/10 16:18:25 WARN manager.MySQLManager: It looks like you are importing from mysql. 23/06/10 16:18:25 WARN manager.MySQLManager: This transfer can be faster! Use the --direct 23/06/10 16:18:25 WARN manager.MySQLManager: option to exercise a MySQL-specific fast path. 23/06/10 16:18:25 INFO manager.MySQLManager: Setting zero DATETIME behavior to convertToNull (mysql) 23/06/10 16:18:25 ERROR tool.ImportTool: Import failed: No primary key could be found for table news. Please specify one with --split-by or perform a sequential import with '-m 1'.
06-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值