HBAse on Windows(windowsでcygwinを使用してhbase問題レコードをインストール)

7794 ワード

手順:
1,
HBase
Download the latest release of HBase from the website. As the HBase distributable is just a zipped archive, installation is as simple as unpacking the archive so it ends up in its finalinstallation directory. Notice that HBase has to be installed in Cygwin and a good directory suggestion is to use  /usr/local/  (or [ Root directory]\usr\local  in Windows slang). You should end up with a  /usr/local/hbase-<version>  installation in Cygwin. This finishes installation. We go on with the configuration.
2,
Configuration
There are 3 parts left to configure: Java, SSH and HBase itself. Following paragraphs explain eacht topic in detail.
Java
One important thing to remember in shell scripting in general (i.e. *nix and Windows) is that managing, manipulating and assembling path names that contains spaces can be very hard, due to the need to escape and quote those characters and strings. So we try to stay away from spaces in path names. *nix environments can help us out here very easily by usingsymbolic links.
Create a link in  /usr/local  to the Java home directory by using the following command and substituting the name of your chosen Java environment:
LN -s /cygdrive/c/Program\ Files/Java/<jre name> /usr/local/<jre name>

Test your java installation by changing directories to your Java folder  CD /usr/local/<jre name>  and issueing the command  ./bin/java -version . This should output your version of the chosen JRE.
SSH
Configuring SSH is quite elaborate, but primarily a question of launching it by default as a Windows service.
On Windows Vista and above make sure you run the Cygwin shell with elevated privileges, by right-clicking on the shortcut an using  Run as Administrator .
First of all, we have to make sure the rights on some crucial files are correct. Use the commands underneath. You can verify all rights by using the  LS -L  command on the different files. Also, notice the auto-completion feature in the shell using  <TAB>  is extremely handy in these situations. chmod +r /etc/passwd  to make the passwords file readable for all chmod u+w /etc/passwd  to make the passwords file writable for the owner chmod +r /etc/group  to make the groups file readable for all chmod u+w /etc/group  to make the groups file writable for the owner chmod 755 /var  to make the var folder writable to owner and readable and executable to all

Edit the /etc/hosts.allow file using your favorite editor (why not VI in the shell!) and make sure the following two lines are in there before the  PARANOID  line: ALL : localhost 127.0.0.1/32 : allow ALL : [::1]/128 : allow

Next we have to configure SSH by using the script  ssh-host-config
If this script asks to overwrite an existing  /etc/ssh_config , answer  yes .
If this script asks to overwrite an existing  /etc/sshd_config , answer  yes .
If this script asks to use privilege separation, answer  yes .
If this script asks to install  sshd  as a service, answer  yes . Make sure you started your shell as Adminstrator!
If this script asks for the CYGWIN value, just  <enter>  as the default is  ntsec .
If this script asks to create the  sshd  account, answer  yes .
If this script asks to use a different user name as service account, answer  no  as the default will suffice.
If this script asks to create the  cyg_server  account, answer  yes . Enter a password for the account.

Start the SSH service using  net start sshd  or  cygrunsrv --start sshd . Notice that  cygrunsrv  is the utility that make the process run as a Windows service. Confirm that you see a message stating that  the CYGWIN sshd service was started succesfully.
Harmonize Windows and Cygwin user account by using the commands: mkpasswd -cl > /etc/passwd mkgroup --local > /etc/group

Test the installation of SSH:
Open a new Cygwin terminal
Use the command  whoami  to verify your userID
Issue an  ssh localhost  to connect to the system itself
Answer  yes  when presented with the server's fingerprint
Issue your password when prompted
test a few commands in the remote session
The  exit  command should take you back to your first shell in Cygwin
Exit  should terminate the Cygwin shell.

HBase If all previous configurations are working properly, we just need some tinkering at the 
HBase config files to properly resolve on Windows/Cygwin. All files and paths referenced here start from the HBase  [installation directory]  as working directory.
HBase uses the  ./conf/hbase-env.sh  to configure its dependencies on the runtime environment. Copy and uncomment following lines just underneath their original, change them to fit your environemnt. They should read something like: export JAVA_HOME=/usr/local/<jre name> export HBASE_IDENT_STRING=$HOSTNAME as this most likely does not inlcude spaces.これは私のマシン上で$HOSTNAMEを解析しないので、システム環境によって構成が異なり、export HBASE_IDENT_STRING=$hostname を使用します.
個別に構成されていないzookeeperがexport HBASE_MANAGES_ZK=true を構成する必要がある場合

HBase uses the ./conf/hbase-default.xml  file for configuration. Some properties do not resolve to existing directories because the JVM runs on Windows. This is the major issue to keep in mind when working with Cygwin: within the shell all paths are *nix-alike, hence relative to the root  / . However, every parameter that is to be consumed within the windows processes themself, need to be Windows settings, hence  C:\ -alike. Change following propeties in the configuration file, adjusting paths where necessary to conform with your own installation: hbase.rootdir  must read e.g.  file:///C:/cygwin/root/tmp/hbase/data hbase.tmp.dir  must read  C:/cygwin/root/tmp/hbase/tmp hbase.zookeeper.quorum  must read  127.0.0.1( localhost ip zk hosts )  because for some reason  localhost  doesn't seem to resolve properly on Cygwin.
自分の構成:hbase.rootdirfile:///F:/cygwin/usr/local/hbase-0.90.5/data            hbase.tmp.dir      F:/cygwin/usr/local/hbase-0.90.5/tmp            hbase.zookeeper.quorum      127.0.0.1            hbase.cluster.distributed     false  

Make sure the configured hbase.rootdir and hbase.tmp.dir directories exist and have the proper rights set up e.g.by issuing a chmod 777 on them.ここで権限は必ず正しいを与えなければならない.