无外网情况下Centos7--为Hadoop集群搭建Sentry(上)

来源:互联网 发布:关于清朝的纪录片 知乎 编辑:程序博客网 时间:2024/06/05 10:25

一、说明

    本文中Hadoop集群搭建在Centos7虚拟机上。(用蓝色字体表示shell命令,红色字体表示出错提示)

    Sentry简介:SentryRhino项目的子项目。在Sentry提出以前,对Hadoop中数据保护是粗粒度的,没有对文件内数据的访问控制:用户要么可以访问整个文件,要么什么都看不到。另外,HDFS权限模式不允许多个组对同一数据集有不同级别的访问权限。Sentry提供对存储在Hadoop集群中数据和元数据集中化、细粒度的基于角色的访问控制。Sentry20138月作为孵化项目被引入到Apache中,2016年拖孵化成为Apache的顶级项目

二、前提条件

    1、安装Mysql

      2、安装Hive

      3、安装Sentry

    本过程分别在三篇博客中详细说明Mysql、Hive、Sentry的安装配置。本博客将详细讲解Mysql的安装过程,后续过程会在后两篇博客中写出。由于时间原因。。。哒哒哒总之就是有时间会更新的。

三、安装步骤

    3.1安装包及依赖包下载

     由于公司要求服务器不允许链接外网,所以需要提前将所需安装包及其依赖包下载并刻录到光盘再拷贝到服务器。链接:网盘分享 密码:m1wu

    3.2解压到指定目录(mysql)

   #tar -xvf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar -C mysql

    解压后有如下rpm:

[root@hadoop1 mysql]# ls -l
总用量 1141908
-rw-r--r-- 1 root root  584652800 5月  13 01:02 mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar
-rw-r--r-- 1 7155 31415  25079412 3月  20 17:40 mysql-community-client-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415    277784 3月  20 17:40 mysql-community-common-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415   3777808 3月  20 17:40 mysql-community-devel-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415  45493312 3月  20 17:40 mysql-community-embedded-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415  23924496 3月  20 17:40 mysql-community-embedded-compat-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 126060264 3月  20 17:40 mysql-community-embedded-devel-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415   2237888 3月  20 17:40 mysql-community-libs-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415   2113196 3月  20 17:40 mysql-community-libs-compat-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415  54661812 3月  20 17:40 mysql-community-minimal-debuginfo-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 169622200 3月  20 17:41 mysql-community-server-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415  14501488 3月  20 17:41 mysql-community-server-minimal-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 116887988 3月  20 17:41 mysql-community-test-5.7.18-1.el7.x86_64.rpm

3.3安装解压后的rmp包

    进入mysql文件夹进行安装。#cd mysql

    由于软件包之间存在依赖关系,所以要注意安装顺序。否则会提示出错。

    比如,如果没有安装common和client就会报错就先安装server就会出错)

   #rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
   警告:mysql-community-server-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID     5072e1f5: NOKEY
错误:依赖检测失败:
        mysql-community-client(x86-64) >= 5.7.9 被 mysql-community-server-5.7.18-1.el7.x86_64 需要
        mysql-community-common(x86-64) = 5.7.18-1.el7 被 mysql-community-server-5.7.18-1.el7.x86_64 需要

先安装common: # rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-common-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
        file /usr/share/mysql/czech/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64conflicts with filefrom package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
        file /usr/share/mysql/danish/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
       ... ...
        file /usr/share/mysql/estonian/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
        file /usr/share/mysql/french/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64

       ... ...

错误提示:来自mysql-ccommunity-common-5.7.18-1.el7.x86_的文件和mariadb-libs-1:5.5.44-2.el7.centos.x86_64的文件冲突。

出现以上安装错误列表的原因是:系统已经安装了其他版本的mysql-libs包和mysql数据库文件导致不兼容。所以就先卸载系统预先安装的sql喽。
解决:# yum remove mysql-libs 
然后重新依次安装:
# rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-common-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   mysql-community-common-5.7.18-1.e################################# [100%]
# rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-libs-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1.mysql-community-libs-5.7.18-1.el7################################# [100%]
# rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-client-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-client-5.7.18-1.e################################# [100%]
# rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-server-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-server-5.7.18-1.e################################# [100%]

# rpm -ivh mysql-community-devel-5.7.18-1.el7.x86_64.rpm (可选安装)
警告:mysql-community-devel-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-devel-5.7.18-1.el################################# [100%]

四、启动并查看状态

启动:

# systemctl start mysqld

查看状态:

# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active:
active (running)since 六 2017-07-29 21:18:27 CST; 28min ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 5791 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 5714 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 5795 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─5795 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
7月 29 21:18:27 hostaa systemd[1]: Starting MySQL Server...
7月 29 21:18:46 hostaa systemd[1]: Started MySQL Server.
7月 29 21:18:59 hostaa systemd[1]: Started MySQL Server.
五、登陆数据库
    这种方式安装好后,会再my.cnf文件中自动生成一个密码,通过以下命令查看:
    # cat /var/log/mysqld.log | grep password
    登陆:#mysql -u root -p
Enter password:输入刚刚查看到的系统自动生成的密码
Welcome to the MySQL monitor.  Commands end with ; or \g
Your MySQL connection id is 7
Server version: 5.7.18
Copyright (c) 2000, 2017, 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.
mysql>
登陆成功以后还不能还不能使用,需要先更改密码。
mysql> SET PASSWORD = PASSWORD('Mysql123456#');
注意:密码必须要含有大、小写,数字、符号。
更改完密码以后就可以使用了:
mysql> create database hcydatabase; 
Query OK, 1 row affected (0.01 sec)
mysql> use hcydatabase; 
Database changed
mysql>


    六、授权远程链接
    mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Mysql123456%' WITH GRANT OPTION;         
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> FLUSH PRIVILEGES;  
Query OK, 0 rows affected (0.01 sec)
这样,我们就可以在其他电脑上的mysql客户端远程连接linux上的mysql数据库




     

  

原创粉丝点击