- Yum 源构建
- Centos 7 系统请用下边的链接
- Centos6系统请用下边的链接,下载后将文件名后边的”.6”去掉。
- (修改前) local all postgres peer (peer 改为 trust)
- (修改后) local all postgres trust
- max_connections
- 2. 修改配置文件
- master_key_type = aes256-cts
- supported_enctypes:支持的校验方式。注意把aes256-cts去掉,JAVA使用aes256-cts验证方式需要安装额外的jar包,所有这里不用。
- 》注: 》 这里会在Loading random data卡很久,属于正常现象
- 大数据平台管理初始化
- Created by cloud-init v. 0.7.5 on Thu, 22 Nov 2018 14:39:22 +0000
- Panel: sudo default
- Panel Server : Service Command
- Panel Agent : For Customizable Users
- Panel Agent : Core System Commands
- Panel Agent : Hadoop and Configuration Commands
- Panel Agent : System User and Group Commands
- Panel Agent : Ranger Commands
- Panel Agent : Infra and logSearch Commands
Yum 源构建
进入指定目录下载/配置
yum
/etc/yum.repos.d/
panel
**yum**
```shell wget http://10.202.80.189/gdp/<版本>/panel/panel.repo
[panel-1.9.1.0-0] name=panel Version - panel-1.9.1.0-0 baseurl=http://10.136.98.40/gdp/arm/1.9.1/panel gpgcheck=0 enabled=1 priority=1
- `kylin_aarch64.repo` **`yum`**
```shell
###Kylin Linux Advanced Server 10 - os repo###
[ks10-adv-os]
name = Kylin Linux Advanced Server 10 - Os
baseurl = http://update.cs2c.com.cn:8080/NS/V10/V10SP1/os/adv/lic/base/$basearch/
gpgcheck = 0
enabled = 1
[ks10-adv-updates]
name = Kylin Linux Advanced Server 10 - Updates
baseurl = http://update.cs2c.com.cn:8080/NS/V10/V10SP1/os/adv/lic/updates/$basearch/
gpgcheck = 0
enabled = 0
[ks10-adv-addons]
name = Kylin Linux Advanced Server 10 - Addons
baseurl = http://update.cs2c.com.cn:8080/NS/V10/V10SP1/os/adv/lic/addons/$basearch/
gpgcheck = 0
enabled = 0
Centos
yum
```shellCentos 7 系统请用下边的链接
wget http://10.202.80.189/gdp/tools/Centos.repo -P /etc/yum.repos.d/
Centos6系统请用下边的链接,下载后将文件名后边的”.6”去掉。
wget http://10.202.80.189/gdp/tools/Centos.repo.6 -P /etc/yum.repos.d/
——————————————— Centos 7 —————————————————————- [Centos7-Tsinghua-base] name=Centos7-Tsinghua-base baseurl=http://yum.internal.gridsumdissector.com:8080/Centos7-Tsinghua-base gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos7-Tsinghua-GPG-KEY [Centos7-Tsinghua-updates] name=Centos7-Tsinghua-updates baseurl=http://yum.internal.gridsumdissector.com:8080/Centos7-Tsinghua-updates gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos7-Tsinghua-GPG-KEY [Centos7-Tsinghua-extras] name=Centos7-Tsinghua-extras baseurl=http://yum.internal.gridsumdissector.com:8080/Centos7-Tsinghua-extras gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos7-Tsinghua-GPG-KEY [epel-7] name=epel-7 baseurl=http://yum.internal.gridsumdissector.com:8080/epel gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/EPEL-7-GPG-KEY [Centos7-163-base] name=Centos7-163-base baseurl=http://yum.internal.gridsumdissector.com:8080/Centos7-163-base gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos7-163-GPG-KEY [Centos7-163-updates] name=Centos7-163-updates baseurl=http://yum.internal.gridsumdissector.com:8080/Centos7-163-updates gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos7-163-GPG-KEY [Centos7-163-extras] name=Centos7-163-extras baseurl=http://yum.internal.gridsumdissector.com:8080/Centos7-163-extras gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos7-163-GPG-KEY
——————————————— Centos 6 —————————————————————-
[Centos6-Tsinghua-base] name=Centos6-Tsinghua-base baseurl=http://yum.internal.gridsumdissector.com:8080/Centos6-Tsinghua-base gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos6-Tsinghua-GPG-KEY
[Centos6-Tsinghua-updates] name=Centos6-Tsinghua-updates baseurl=http://yum.internal.gridsumdissector.com:8080/Centos6-Tsinghua-updates gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos6-Tsinghua-GPG-KEY
[Centos6-Tsinghua-extras] name=Centos6-Tsinghua-extras baseurl=http://yum.internal.gridsumdissector.com:8080/Centos6-Tsinghua-extras gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos6-Tsinghua-GPG-KEY
[Centos6-163-base] name=Centos6-163-base baseurl=http://yum.internal.gridsumdissector.com:8080/Centos6-163-base gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos6-163-GPG-KEY
[Centos6-163-updates] name=Centos6-163-updates baseurl=http://yum.internal.gridsumdissector.com:8080/Centos6-163-updates gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos6-163-GPG-KEY
[Centos6-163-extras] name=Centos6-163-extras baseurl=http://yum.internal.gridsumdissector.com:8080/Centos6-163-extras gpgcheck=1 gpgkey=http://yum.internal.gridsumdissector.com:8080/Centos6-163-GPG-KEY
[epel-6] name=epel-6 baseurl=http://yum.internal.gridsumdissector.com:8080/epel-6 gpgcheck=0
---
<a name="mRiOY"></a>
## 其他的初始化服务
<a name="zvihX"></a>
### 1. postgresql
<a name="yitMz"></a>
#### 1. yum 下载
```shell
### 1.通过 yum 源下载 postgresql *
yum install postgresql*
2. 初始化数据库
安装完成之后,不能直接启动数据库,需要先执行初始化,初始化之后,会生成postgresql相关配置文件和数据库文件,他们都会存放在路径
/var/lib/pgsql/data
下。
postgresql-setup initdb
[root@localhost data]# postgresql-setup initdb
3. 修改配置文件
vim pg_hba.conf
```shell修改
(修改前) local all postgres peer (peer 改为 trust)
(修改后) local all postgres trust
填充一行
host all postgres 0.0.0.0/0 md5
![image.png](https://cdn.nlark.com/yuque/0/2021/png/667110/1618206920950-09d122af-15da-49a7-96c4-77266f43655f.png#align=left&display=inline&height=163&margin=%5Bobject%20Object%5D&name=image.png&originHeight=325&originWidth=790&size=99749&status=done&style=none&width=395)
- `vim postgresql.conf`
```shell
#### 开启所有 IP 请求
listen_addresses = '*'
#### 设置最大连接数
max_connections = 1000
4. 启动数据库
service postgresql start
chkconfig postgresql on
[root@localhost data]# service postgresql start
Redirecting to /bin/systemctl start postgresql.service
##### 设置开机自启
[root@panel-5 data]# chkconfig postgresql on
注意:正在将请求转发到“systemctl enable postgresql.service”。
5. 登录数据库
su - postgres -c psql
alter role postgres with password 'postgres';
```shell登录到数据库
[root@panel-5 data]# su - postgres -c psql psql (10.5) 输入 “help” 来获取帮助信息.
修改 postgres 用户密码
postgres=# alter role postgres with password ‘postgres’; ALTER ROLE
查看修改后的最大连接数是否生效
postgres=# show max_connections ;
max_connections
1000 (1 行记录)
退出
postgres=# \q [root@panel-5 data]#
<a name="7SB1L"></a>
#### 6. 可能会出现的问题
1. org.postgresql.util.PSQLException: ��������: ���� "postgres" Password ��������
- 类似上面的错误可能是密码错误
2. `service postgresql restart` 重启 `postgresql` 失败
- 详细信息查看 `systemctl status postgresql.service` 的输出
---
<a name="p5MH7"></a>
### 2. Kerberos
<a name="XBFyi"></a>
#### 1. yum 下载
```shell
##### Server 端操作下面命令
yum install -y krb5-server krb5-workstation krb5-libs
##### Client 端操作下面命令
yum install -y krb5-workstation krb5-libs
2. 修改配置文件
vim /var/kerberos/krb5kdc/kdc.conf
- 该文件只有在
Server
上有,Client
是没有的
```shell [kdcdefaults] kdc_ports = 88 kdc_tcp_ports = 88
[realms]
GRIDSUM.COM = {
master_key_type = aes256-cts
acl_file = /var/kerberos/krb5kdc/kadm5.acl dict_file = /usr/share/dict/words admin_keytab = /var/kerberos/krb5kdc/kadm5.keytab supported_enctypes = aes128-cts:normal des3-hmac-sha1:normal arcfour-hmac:normal des-hmac-sha1:normal des-cbc-md5:normal des-cbc-crc:normal }
supported_enctypes:支持的校验方式。注意把aes256-cts去掉,JAVA使用aes256-cts验证方式需要安装额外的jar包,所有这里不用。
- `vim /etc/krb5.conf`
- **`Server``/Client`** 都是一样的
```shell
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
default_realm = GRIDSUM.COM
dns_lookup_realm = false
dns_lookup_kdc = false
ticket_lifetime = 24h
renew_lifetime = 7d
forwardable = true
udp_preference_limit = 1
[realms]
GRIDSUM.COM = {
kdc = localhost
admin_server = localhost
}
[domain_realm]
.example.com = GRIDSUM.COM
example.com = GRIDSUM.COM
vim /var/kerberos/krb5kdc/kadm5.acl
只有
Server
有该文件 (给管理员实例的所有主体授权)*/admin@GRIDSUM.COM *
3. 初始化 生成
Kerberos
数据库以下在
Server
节点执行 ```shell [root@panel-5 ~]# kdb5_util create -s
Loading random data Initializing database ‘/var/kerberos/krb5kdc/principal’ for realm ‘XXX.COM’, master key name ‘K/M@XXX.COM’ You will be prompted for the database Master Password. It is important that you NOT FORGET this password. Enter KDC database master key: (输入密码 kerberos) Re-enter KDC database master key to verify: (确认密码 kerberos)
》注: 》 这里会在Loading random data卡很久,属于正常现象
- 创建实例
```shell
[root@panel-5 ~]# kadmin.local
Authenticating as principal admin/admin@GRIDSUM.COM with password.
kadmin.local: add
addpol add_policy addprinc add_principal
kadmin.local: addprinc "test/admin@GRIDSUM.COM" (实例名称)
WARNING: no policy specified for test/admin@GRIDSUM.COM; defaulting to no policy
Enter password for principal "test/admin@GRIDSUM.COM": (该实例密码)
Re-enter password for principal "test/admin@GRIDSUM.COM": (该实例密码)
Principal "test/admin@GRIDSUM.COM" created.
kadmin.local: listprincs (查看用户列表)
K/M@GRIDSUM.COM
admin/admin@GRIDSUM.COM
kadmin/admin@GRIDSUM.COM
kadmin/changepw@GRIDSUM.COM
kadmin/panel-5@GRIDSUM.COM
kiprop/panel-5@GRIDSUM.COM
krbtgt/GRIDSUM.COM@GRIDSUM.COM
test/admin@GRIDSUM.COM (刚创建的实例 ---《)
kadmin.local: exit (退出local)
4. 启动 Kerberos - Server 服务
在
Server
节点service krb5kdc start
service kadmin start
# 设置开机自启
chkconfig krb5kdc on
chkconfig kadmin on
5. Kerberos - Client 初始化 /etc/krb5.conf
vim /etc/krb5.conf
(配置域信息,直接把Server
配好的krb5.conf内容
Copy
过来)
6. kinit 管理员验证
[root@panel-5 ~]# kinit test/admin@GRIDSUM.COM (验证在上面创建的实例)
Password for test/admin@GRIDSUM.COM:
kinit: Password incorrect while getting initial credentials
[root@panel-5 ~]# klist (查询登录状态)
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: test/admin@GRIDSUM.COM (《--》 登录成功)
Valid starting Expires Service principal
2021-04-11T21:57:18 2021-04-12T21:57:18 krbtgt/GRIDSUM.COM@GRIDSUM.COM
renew until 2021-04-11T21:57:18
7. 其他命令 (下面的可以不用试)
##### 退出 【kdestroy】
[root@panel-5 ~]# kdestroy
[root@panel-5 ~]# klist
klist: No credentials cache found (filename: /tmp/krb5cc_0)
##### 查看用户列表 【listprincs】
kadmin.local: listprincs
K/M@GRIDSUM.COM
admin/admin@GRIDSUM.COM
kadmin/admin@GRIDSUM.COM
kadmin/changepw@GRIDSUM.COM
kadmin/panel-5@GRIDSUM.COM
kiprop/panel-5@GRIDSUM.COM
krbtgt/GRIDSUM.COM@GRIDSUM.COM
test/admin@GRIDSUM.COM
#### 删除用户 【delete_principal】
kadmin.local: delete_principal test/admin
Are you sure you want to delete the principal "test/admin@GRIDSUM.COM"? (yes/no): yes
Principal "test/admin@GRIDSUM.COM" deleted.
Make sure that you have removed this principal from all ACLs before reusing.
kadmin.local: listprincs
K/M@GRIDSUM.COM
admin/admin@GRIDSUM.COM
kadmin/admin@GRIDSUM.COM
kadmin/changepw@GRIDSUM.COM
kadmin/panel-5@GRIDSUM.COM
kiprop/panel-5@GRIDSUM.COM
krbtgt/GRIDSUM.COM@GRIDSUM.COM
##### 只导出用户keytab文件(并且不要修改密码)
kadmin.local: xst -k admin.keytab -norandkey admin/admin@GRIDSUM.COM
Entry for principal admin/admin@GRIDSUM.COM with kvno 1, encryption type aes128-cts-hmac-sha1-96 added to keytab WRFILE:admin.keytab.
Entry for principal admin/admin@GRIDSUM.COM with kvno 1, encryption type des3-cbc-sha1 added to keytab WRFILE:admin.keytab.
Entry for principal admin/admin@GRIDSUM.COM with kvno 1, encryption type arcfour-hmac added to keytab WRFILE:admin.keytab.
Entry for principal admin/admin@GRIDSUM.COM with kvno 1, encryption type des-hmac-sha1 added to keytab WRFILE:admin.keytab.
Entry for principal admin/admin@GRIDSUM.COM with kvno 1, encryption type des-cbc-md5 added to keytab WRFILE:admin.keytab.
8. 可能会出现的问题
Server 端的错误
kdb5_util: Improper format of Kerberos configuration file while initializing Kerberos code
- 原因以及解决办法:这是由于/etc/krb5.conf 配置错了或者配置了无效项。检查这个文件。
- 注意大小学 (Keberos 域信息区分大小写)
klist: Credentials cache keyring 'persistent:0:0' not found 或者是
kinit: Cannot contact any KDC for realm 'GRIDSUM.COM' while getting initial credentials
- 解决:出现上述错误是由于
krb5kdc
服务以及kadmin
服务没有启动导致或者在当前的客户端没有配置服务端主机的主机名映射关系,修改hosts
文件 或者查看/etc/krb5.conf
下的 该参数 (需要跟hosts 中的名称一致,或者直接改成 ip 地址)
- 查看ticket是否是renewable
- ticket无法更新
Client 的错误
- 使用
kinit
如下命令时kinit admin/admin
出现
kinit: Unknown credential cache type while getting default ccache
清除
/etc/krb5.conf
缓存sed -ri "s/^ default_ccache_name = (.*)/# default_ccache_name = \1/g" /etc/krb5.conf
参考:
大数据平台管理初始化
1. 创建 Panel 用户
useradd panel
(添加 Panell 用户)vim /etc/sudoers.d/panel
(增加 sudo 权利) ```shellCreated by cloud-init v. 0.7.5 on Thu, 22 Nov 2018 14:39:22 +0000
Panel: sudo default
Defaults exempt_group = panel Defaults !env_reset,env_delete-=PATH Defaults: panel !requiretty
Panel Server : Service Command
panel ALL=(ALL) NOPASSWD:SETENV:/usr/sbin/kadmin.local, /usr/bin/env service postgresql-10 ,/bin/sh -c ulimit , /sbin/service krb5kdc ,/sbin/service kadmin
Panel Agent : For Customizable Users
panel ALL=(ALL) NOPASSWD:SETENV:/bin/su postgres ,/bin/su zookeeper ,/bin/su ams ,/bin/su ambari-qa ,/bin/su hdfs ,/bin/su yarn ,/bin/su mapred ,/bin/su hive ,/bin/su tez ,/bin/su livy ,/bin/su spark ,/bin/su kafka ,/bin/su hbase ,/bin/su hcat ,/bin/su slider ,/bin/su infra-solr ,/bin/su impala ,/bin/su redis ,/bin/su atlas ,/bin/su airflow ,/bin/su METASPACE ,/bin/su liveinsight ,/bin/su ranger ,/bin/su dimmetrics ,/bin/su testA ,/bin/su testB ,/bin/su panel ,/bin/su admin,/bin/su panel-qa ,/bin/su logsearch ,/bin/su elasticsearch ,/bin/su janusgraph ,/bin/su metaspace ,/bin/su taskflow ,/bin/su datasocket ,/bin/su datastudio ,/bin/su taskcenter *
Panel Agent : Core System Commands
panel ALL=(ALL) NOPASSWD:SETENV: /usr/bin/yum,/usr/bin/zypper,/usr/bin/apt-get, /bin/mkdir, /usr/bin/test, /bin/ln, /bin/ls, /bin/chown, /bin/chmod, /bin/chgrp, /bin/cp, /usr/sbin/setenforce, /usr/bin/test, /usr/bin/stat, /bin/mv, /bin/sed, /bin/rm, /bin/kill, /bin/readlink, /usr/bin/pgrep, /bin/cat, /usr/bin/unzip, /bin/tar, /usr/bin/tee, /bin/touch, /usr/bin/mysql, /sbin/service mysqld , /usr/bin/dpkg , /bin/rpm , /usr/sbin/hst , /sbin/chkconfig —add impala-catalog, /sbin/service impala-catalog ,/sbin/service impala-server , /sbin/chkconfig —add impala-server, /sbin/chkconfig —add impala-state-store, /sbin/service impala-state-store , /bin/echo, /sbin/service redis-sentinel ,/sbin/service redis *,/bin/sh
Panel Agent : Hadoop and Configuration Commands
panel ALL=(ALL) NOPASSWD:SETENV: /usr/bin/hdp-select, /usr/bin/conf-select, /usr/hdp/current/hadoop-client/sbin/hadoop-daemon.sh, /usr/lib/hadoop/bin/hadoop-daemon.sh, /usr/lib/hadoop/sbin/hadoop-daemon.sh, /usr/bin/ambari-python-wrap ,/usr/bin/impala-shell,/var/lib/ambari-agent/tmp/create-python-wrap.sh,/usr/bin/python ,/usr/sbin/panel-server ,/usr/sbin/panel-agent
Panel Agent : System User and Group Commands
panel ALL=(ALL) NOPASSWD:SETENV: /usr/sbin/groupadd, /usr/sbin/groupmod, /usr/sbin/useradd, /usr/sbin/usermod
Panel Agent : Ranger Commands
panel ALL=(ALL) NOPASSWD:SETENV: /usr/hdp//ranger-usersync/setup.sh, /usr/bin/ranger-usersync-stop, /usr/bin/ranger-usersync-start, /usr/hdp//ranger-admin/setup.sh , /usr/hdp//ranger-hbase-plugin/disable-hbase-plugin.sh , /usr/hdp//ranger-hdfs-plugin/disable-hdfs-plugin.sh , /usr/hdp/current/ranger-admin/ranger_credential_helper.py, /usr/hdp/current/ranger-kms/ranger_credential_helper.py, /usr/hdp//ranger-/ranger_credential_helper.py,/usr/bin/ranger-usersync ,/usr/local/jdk/bin/java *
Panel Agent : Infra and logSearch Commands
panel ALL=(ALL) NOPASSWD:SETENV: /usr/lib/ambari-infra-solr/bin/solr , /usr/lib/ambari-logsearch-logfeeder/run.sh , /usr/sbin/ambari-metrics-grafana , /usr/lib/ambari-infra-solr-client/solrCloudCli.sh
- `ssh-keygen –t rsa` (切换到 `panel` 用户生成ssh密钥)
- `ssh-copy-id –i /home/panell/.ssh/id_rsa all_host` (将主节点的 `Panell` 用户的公钥拷贝到每个节点)
---
<a name="WDEpS"></a>
### 2. 安装 Panel - server
`yum install -y ambari-server` (使用 **`root`** 用户安装 `panel server`)
---
<a name="Ko2Ie"></a>
### 3. 初始化 Panel - Server
- 使用 root 用户初始化
- 选择使用的 JDK
```shell
#使用root用户初始化
$ panel-server setup
Using python /usr/bin/python
Setup panel -server
Checking SELinux...
SELinux status is 'disabled'
Customize user account for ambari-server daemon [y/n] (n)? 回车
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[3] Custom JDK
=========================================================================
Enter choice (1): 3 #选择Custom JDK
WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts.
WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.
Path to JAVA_HOME: /usr/local/jdk #输入JAVA_HOME
Validating JDK on panel Server...done.
Checking GPL software agreement...
GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
Enable panel Server to download and install GPL Licensed LZO packages [y/n] (n)? Y
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? 回车
Configuring database...
Default properties detected. Using built-in database.
Configuring ambari database...
Checking PostgreSQL...
Running initdb: This may take up to a minute.
Initializing database: [ OK ]
About to start PostgreSQL
Configuring local database...
Configuring PostgreSQL...
Restarting PostgreSQL
Creating schema and user...
done.
Creating tables...
done.
Extracting system views...
..ambari-admin-2.6.1.0.0.jar
.
Adjusting ambari-server permissions and ownership...
Panel Server 'setup' completed successfully. #出现此提示表示成功
4. 启动 Panel - Server
panel-server start
出现的问题
INFO:root:BootStrapping hosts ['panel-5'] using /usr/lib/python2.6/site-packages/ambari_server cluster primary OS: kylin linux advanced server release v10 with user 'panel'with ssh Port '22' sshKey File /var/run/ambari-server/bootstrap/3/sshKey password File null using tmp dir /var/run/ambari-server/bootstrap/3 ambari: panel-5; server_port: 8080; ambari version: 1.8.2.0; user_run_as: panel
INFO:root:Executing parallel bootstrap
Panel-server与Panel-agent冲突
- 使用
rpm -ivh ./ambari-agent-1.9.1.0-0.ky10.aarch64.rpm --replacefiles
安装
卸載 Panel
yum erase + 组件名
完全删除时开始运行以下脚本 (remove_panel.sh
)
#!/bin/bash
# author 朱学通
#需要在所有panel节点执行,此脚本会清除panel相关的文件及大数据安装文件
echo 停止panel server及panel agent
panel-server stop
panel-agent stop
user_array=(ams elasticsearch flink gsadmin hbase hcat hdfs hive infra-solr kafka livy mapred panel panel-qa spark tez user yarn zookeeper impala janusgraph ranger hadoop redis postgres slider)
for user in "${user_array[@]}";
do
egrep "^$user" /etc/passwd 2>/dev/null
if [ $? -eq 0 ]
then
echo 关闭用户${user}的进程
ps -u${user} 2>/dev/null|awk '{if (NR>1){print $1}}'|xargs kill -9
fi
done
echo 删除安装包
yum remove -y ambari*
yum remove -y hadoop*
yum remove -y spark*
yum remove -y flink*
yum remove -y impala*
yum remove -y hive*
yum remove -y oozie*
yum remove -y pig*
yum remove -y zookeeper*
yum remove -y tez*
yum remove -y hbase*
yum remove -y ranger*
yum remove -y knox*
yum remove -y hdp-select*
yum remove -y livy*
yum remove -y janusgraph*
yum remove -y bigtop*
yum remove -y elasticsearch*
yum remove -y redis*
yum remove -y postgresql10*
yum clean all
echo 删除库文件
rm -rf /var/lib/ambari*
rm -rf /var/lib/ambari-agent
rm -rf /var/lib/hadoop*
rm -rf /var/lib/elasticsearch
rm -rf /var/lib/hive
rm -rf /var/lib/impala
rm -rf /var/lib/redis
rm -rf /var/lib/slider
rm -rf /var/lib/zookeeper
rm -rf /usr/lib/ambari*
rm -rf /usr/lib/python2.6/site-packages/ambari_*
rm -rf /usr/lib/python2.6/site-packages/resource_management
rm -rf /usr/lib/flume
rm -rf /usr/lib/storm
rm -rf /var/lib/ranger
rm -rf /tmp/hadoop-hdfs
rm -rf /var/log/webhcat
rm -rf /hadoop/zookeeper
rm -rf /hadoop/hdfs
rm -rf /hadoop/yarn
rm -rf /kafka-logs
rm -rf /tmp/hive
echo 删除/etc下的配置目录
rm -rf /etc/elasticsearch
rm -rf /etc/janusgraph
rm -rf /etc/ranger*
rm -rf /etc/ambari*
rm -rf /etc/hadoop
rm -rf /etc/hbase
rm -rf /etc/hive*
rm -rf /etc/impala
rm -rf /etc/livy*
rm -rf /etc/oozie
rm -rf /etc/sqoop
rm -rf /etc/zookeeper
rm -rf /etc/flume
rm -rf /etc/storm
rm -rf /etc/tez
rm -rf /etc/spark*
rm -rf /etc/phoenix
rm -rf /etc/pig
rm -rf /etc/tez
rm -rf /etc/falcon
rm -rf /etc/knox
rm -rf /etc/kafka
rm -rf /etc/slider
rm -rf /etc/ssoconf
echo 删除/var/run的PID文件
rm -rf /var/run/elasticsearch
rm -rf /var/run/ranger*
rm -rf /var/run/ambari*
rm -rf /var/run/hadoop*
rm -rf /var/run/hbase
rm -rf /var/run/janusgraph
rm -rf /var/run/hive*
rm -rf /var/run/impala
rm -rf /var/run/livy*
rm -rf /var/run/oozie
rm -rf /var/run/sqoop
rm -rf /var/run/zookeeper
rm -rf /var/run/flume
rm -rf /var/run/storm
rm -rf /var/run/tez
rm -rf /var/run/spark*
rm -rf /var/run/phoenix
rm -rf /var/run/pig
rm -rf /var/run/tez
rm -rf /var/run/falcon
rm -rf /var/run/knox
rm -rf /var/run/kafka
rm -rf /var/run/slider
echo 删除/var/log的日志文件
rm -rf /var/log/elasticsearch
rm -rf /var/log/ranger*
rm -rf /var/log/ambari*
rm -rf /var/log/hadoop*
rm -rf /var/log/hbase
rm -rf /var/log/hive*
rm -rf /var/log/impala
rm -rf /var/log/livy*
rm -rf /var/log/oozie
rm -rf /var/log/sqoop
rm -rf /var/log/zookeeper
rm -rf /var/log/flume
rm -rf /var/log/storm
rm -rf /var/log/tez
rm -rf /var/log/spark*
rm -rf /var/log/phoenix
rm -rf /var/log/pig
rm -rf /var/log/tez
rm -rf /var/log/falcon
rm -rf /var/log/knox
rm -rf /var/log/kafka
rm -rf /var/log/slider
rm -rf /var/log/janusgraph
rm -rf /var/log/redis
rm -rf /var/log/panel-agent
rm -rf /var/log/panel-server
rm -rf /var/log/krb5kdc.log*
rm -rf /var/log/kadmind.log*
echo 临时文件
rm -rf /var/tmp/*
echo 删除数据库
rm -rf /var/lib/pgsql
rm -rf /usr/pgsql-10
rm -rf /pg_data
echo 删除符号连接
cd /usr/bin
rm -rf accumulo
rm -rf atlas-start
rm -rf atlas-stop
rm -rf beeline
rm -rf falcon
rm -rf flume-ng
rm -rf hbase
rm -rf hcat
rm -rf hdfs
rm -rf hive
rm -rf hiveserver2
rm -rf kafka
rm -rf mahout
rm -rf mapred
rm -rf oozie
rm -rf oozied.sh
rm -rf phoenix-psql
rm -rf phoenix-queryserver
rm -rf phoenix-sqlline
rm -rf phoenix-sqlline-thin
rm -rf pig
rm -rf python-wrap
rm -rf ranger-admin
rm -rf ranger-admin-start
rm -rf ranger-admin-stop
rm -rf ranger-kms
rm -rf ranger-usersync
rm -rf ranger-usersync-start
rm -rf ranger-usersync-stop
rm -rf slider
rm -rf sqoop
rm -rf sqoop-codegen
rm -rf sqoop-create-hive-table
rm -rf sqoop-eval
rm -rf sqoop-export
rm -rf sqoop-help
rm -rf sqoop-import
rm -rf sqoop-import-all-tables
rm -rf sqoop-job
rm -rf sqoop-list-databases
rm -rf sqoop-list-tables
rm -rf sqoop-merge
rm -rf sqoop-metastore
rm -rf sqoop-version
rm -rf storm
rm -rf storm-slider
rm -rf worker-lanucher
rm -rf yarn
rm -rf zookeeper-client
rm -rf zookeeper-server
rm -rf zookeeper-server-cleanup
#echo 删除kerberos安装包
#yum remove -y krb5-server krb5-workstation
#echo 删除kerberos文件
#rm -rf /var/kerberos/
#rm /etc/krb5.conf
#rm -rf /usr/lib64/krb5
#rm -rf /etc/krb5.conf.d
echo 删除hadoop数据文件
rm -rf /hadoop
rm -rf /kafka-logs
rm -rf /impalad
echo 删除服务的启动脚本
rm -rf /etc/init.d/impala*
rm -rf /etc/init.d/panel-server
#echo 修改panel.repo文件权限
#chown root.root /etc/yum.repos.d/panel.repo
echo panel及hadoop集群移除完成,请重启服务器,然后重新安装panel