Centos7 安装 CDH 6.2(二):安装Cloudera Manage

文章目录

      • 1. 配置CM、CDH本地yum源
      • 2. 安装Cloudera-Manage-Server
      • 3. 安装、配置数据库(使用外部数据库,可跳过此步骤)
      • 4. 添加CM使用的数据库
      • 5. 配置CM数据库连接
      • 6. 启动CM

1. 配置CM、CDH本地yum源

# c7-1.com 执行
yum install createrepo httpd -y
systemctl enable httpd
systemctl start httpd
# 安装 CM key
rpm --import https://archive.cloudera.com/cm6/6.2.0/redhat7/yum/RPM-GPG-KEY-cloudera
# 配置本地源
mkdir -p /var/www/html/cloudera-repos
# 下载CM包
wget --recursive --no-parent --no-host-directories https://archive.cloudera.com/cm6/6.2.0/redhat7/ -P /var/www/html/cloudera-repos
wget https://archive.cloudera.com/cm6/6.2.0/allkeys.asc -P /var/www/html/cloudera-repos/cm6/6.2.0/
# 下载CDH包
wget --recursive --no-parent --no-host-directories https://archive.cloudera.com/cdh6/6.2.0/redhat7/ -P /var/www/html/cloudera-repos
wget --recursive --no-parent --no-host-directories https://archive.cloudera.com/gplextras6/6.2.0/redhat7/ -P /var/www/html/cloudera-repos
# 下载Apache Accumulo for CDH
wget --recursive --no-parent --no-host-directories https://archive.cloudera.com/accumulo-c5/redhat/ -P /var/www/html/cloudera-repos
# 配置访问权限
chmod -R ugo+rX /var/www/html/cloudera-repos/
# 创建本地yum源
cd /var/www/html/cloudera-repos
createrepo .
# 配置本地yun源
vim /etc/yum.repos.d/cloudera-manager.repo
	# 添加以下内容
    [cloudera-manager]
    name=Cloudera Manager 6.2.0
    baseurl=http://10.0.0.101/cloudera-repos/cm6/6.2.0/redhat7/yum/
    gpgcheck=1
    enabled=1
    autorefresh=0
    type=rpm-md

2. 安装Cloudera-Manage-Server

# c7-1.com 执行
yum install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server -y

3. 安装、配置数据库(使用外部数据库,可跳过此步骤)

# 通过docker安装mysql5.7版本
# 安装docker
curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror AzureChinaCloud

sudo systemctl enable docker
sudo systemctl start docker
# 配置镜像加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
    "exec-opts": [
        "native.cgroupdriver=systemd"
    ],
    "registry-mirrors": [
        "https://registry.docker-cn.com"
    ],
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "500m",
        "max-file": "3"
    }
}
EOF
# 退出 vim 执行以下命令
sudo systemctl daemon-reload
sudo systemctl restart docker
# 创建mysql配置文件
# c7-1.com 执行
tee /etc/mysql.d/cdh.cnf<<-'EOF'
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
transaction-isolation = READ-COMMITTED
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
symbolic-links = 0

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
#expire_logs_days = 10
#max_binlog_size = 100M

#log_bin should be on a disk with enough free space.
#Replace '/var/lib/mysql/mysql_binary_log' with an appropriate path for your
#system and chown the specified folder to the mysql user.
log_bin=/var/lib/mysql/mysql_binary_log

#In later versions of MySQL, if you enable the binary log and do not set
#a server_id, MySQL will not start. The server_id must be unique within
#the replicating group.
server_id=1

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

sql_mode=STRICT_ALL_TABLES
EOF

# 创建mysql 容器
docker run --name mysql -d \
--restart=always \
-p 3306:3306 \
-v mysql_data:/var/lib/mysql \
-v /etc/my.cnf.d/cdh.cnf:/etc/mysql/conf.d/cdh.cnf \
-e MYSQL_ROOT_PASSWORD=yltest \
mysql:5.7 --character-set-server=utf8mb4

4. 添加CM使用的数据库

# c7-1.com 执行
# 登录数据库
docker exec -it mysql mysql -u root -p
    # 执行以下创建数据库命令
    CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm@123';
    CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'amon@123';
    CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'rman@123';
    CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'hue@123';
    CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON metastore.* TO 'metastore'@'%' IDENTIFIED BY 'metastore@123';
    CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'sentry@123';
    CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'nav@123';
    CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'navms@123';
    CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie@123';
    CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON hive.* TO 'hive'@'%' IDENTIFIED BY 'hive@123';
    flush privileges;

5. 配置CM数据库连接

# c7-[1-3].com 执行
# 安装mysql-connect-j驱动
rpm -ivh https://github.com/DemonJun/Files/raw/master/mysql-connector-java-8.0.20-1.el7.noarch.rpm
# c7-1.com 执行
# 配置CM数据库连接信息
# /opt/cloudera/cm/schema/scm_prepare_database.sh [options]    
/opt/cloudera/cm/schema/scm_prepare_database.sh -h 127.0.0.1 -P 3306 mysql scm scm scm@123

6. 启动CM

systemctl start cloudera-scm-server
# 查看启动日志
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
# When you see this log entry, the Cloudera Manager Admin Console is ready:
# INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server.
# In a web browser, go to http://:7180, where  is the FQDN or IP address of the host where the Cloudera Manager Server is running
# 默认账号密码:admin admin

你可能感兴趣的:(大数据之路)