Ubuntu 14.04用apt在线/离线安装CDH5.1.2[Apache Hadoop 2(3)

  由于CDH有多个版本,作者不建议单独下载安装,可以通过cloudera-manager-daemons、cloudera-manager-server、cloudera-manager-agent来安装,本文后面会有介绍。

4、如何安装 4.1、设置Host

  修改Host

root@m1:~# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.10 m1.linuxidc.com m1 192.168.1.11 m2.linuxidc.com m2 192.168.1.12 s1.linuxidc.com s1 192.168.1.13 s2.linuxidc.com s2 # The following lines are desirable for IPv6 capable hosts ff02::1 ip6-allnodes ff02::2 ip6-allrouters 4.2、设置静态IP

  修改成静态IP地址

root@m1:~# vi /etc/network/interfaces iface wlan0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 192.168.1.1 dns-nameservers 8.8.8.8 4.3、设置Host

  修改主机名称

root@m1:~# cat /etc/hostname m1.linuxidc.com 4.4、关闭防火墙 root@m1:~# ufw disable 4.5、安装JDK7,CDH5要求至少是Oracle JDK7

  添加 PPA repository 到系统

root@m1:~# add-apt-repository ppa:webupd8team/java root@m1:~# apt-get update root@m1:~# sudo apt-get upgrade

1

2

3

  过程中会弹出个框,选择YES,因为要下载二进制包,所以可能会慢一些

root@m1:~# apt-get install oracle-java7-installer

  
  将Oracle 7 设置成默认版本

root@m1:~# apt-get install oracle-java7-set-default

   查看当前Java版本

root@m1:~# java -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode) 4.6、安装MySql最新版,CM的数据库我们用My Sql管理

  安装Mysql Server,后面在安装Cloudera Manager的时候会用到,如果你要使用PostGreSQL ,可以跳过这一步 (4.6-4.8)。
  

4.6.1、在主机上使用apt-get安装My Sql

  在主机上使用apt-get安装My Sql,安装过程中会有提示,一直接回车就可以 (4台机器都要执行)

root@m1:~# apt-get install mysql-server 4.6.2、修改MySql配置,方便CM使用 4.6.2.1、配置MySql的监听地址

  对MySQL的配置项进行修改,先备份,找到“bind-address = 127.0.0.1”这一行,然后注释掉,改成“bind-address = 0.0.0.0”

root@m1:~# cp /etc/mysql/my.cnf /etc/mysql/my.cnf.bak root@m1:~# vi /etc/mysql/my.cnf #bind-address = 127.0.0.1 bind-address = 0.0.0.0 4.6.2.2、配置MySql的其他配置,为了CM使用

  MySql配置中,其中对于Cloudera的支持,可以参考官方描述

[client] default-character-set=utf8 [mysqld] transaction-isolation=READ-COMMITTED # Disabling symbolic-links is recommended to prevent assorted security risks; # to do so, uncomment this line: # symbolic-links=0 character-set-server=utf8 key_buffer = 16M key_buffer_size = 32M max_allowed_packet = 32M thread_stack = 256K thread_cache_size = 64 query_cache_limit = 8M query_cache_size = 64M query_cache_type = 1 max_connections = 550 # log-bin should be on a disk with enough free space # NOTE: replace '/x/home/mysql/logs/binary' below with # an appropriate path for your system. log-bin=/x/home/mysql/logs/binary/mysql_binary_log # For MySQL version 5.1.8 or later. Comment out binlog_format for older versions. binlog_format = mixed read_buffer_size = 2M read_rnd_buffer_size = 16M sort_buffer_size = 8M join_buffer_size = 8M # InnoDB settings innodb_file_per_table = 1 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 64M innodb_buffer_pool_size = 4G innodb_thread_concurrency = 8 innodb_flush_method = O_DIRECT innodb_log_file_size = 512M [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid 4.7、创建后面在CM中会使用的数据库 root@m1:~# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 42 Server version: 5.5.38-0ubuntu0.14.04.1 (Ubuntu) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. ## Cloudera manager db user, database and grant mysql> create user 'cmf'@'%' identified by 'xyz'; Query OK, 0 rows affected (0.00 sec) mysql> create database cmf DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on cmf.* to 'cmf'@'%' identified by 'xyz'; Query OK, 0 rows affected (0.00 sec) ## For activity monitor mysql> create user 'amon'@'%' identified by 'xyz'; Query OK, 0 rows affected (0.00 sec) mysql> create database amon DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on amon.* to 'amon'@'%' identified by 'xyz'; Query OK, 0 rows affected (0.00 sec) ## Hive Meta store mysql> create user 'hive'@'%' identified by 'xyz'; Query OK, 0 rows affected (0.00 sec) mysql> create database metastore DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on metastore.* to 'hive'@'%' identified by 'xyz'; Query OK, 0 rows affected (0.00 sec) ## Flush all changes mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) 4.8、重启MySql,查看3306端口,并安装MySql���Java的支持 root@m1:~# service mysql restart root@m1:~# netstat -tulpn | grep :3306 tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2207/mysqld root@m1:~# apt-get install libmysql-java Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: liblog4j1.2-java libcommons-logging-java The following NEW packages will be installed: libmysql-java 0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded. Need to get 894 kB of archives. After this operation, 1,060 kB of additional disk space will be used. Get:1 trusty/universe libmysql-java all 5.1.28-1 [894 kB] Fetched 894 kB in 1s (718 kB/s) Selecting previously unselected package libmysql-java. (Reading database ... 96338 files and directories currently installed.) Preparing to unpack .../libmysql-java_5.1.28-1_all.deb ... Unpacking libmysql-java (5.1.28-1) ... Setting up libmysql-java (5.1.28-1) ... root@m1:~# 4.9、安装Cloudera Manager组件 4.9.1、将Ubuntu 14.04暂时伪造成Ubuntu12.04

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/fc4f1606d3d2b62a39d1ca21c02e6a8c.html