Linux一些遇到的坑和笔记

关闭SElinux

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
查看SELinux状态:
1、/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态
SELinux status: enabled
2、getenforce ##也可以用这个命令检查

关闭SELinux:
1、临时关闭(不用重启机器):
setenforce 0 ##设置SELinux 成为permissive模式
##setenforce 1 设置SELinux 成为enforcing模式

2、修改配置文件需要重启机器:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
重启机器即可

这里遇到这个问题实在是不应该,别修改错了,注意不是SELINUXTPYE

CentOS7关闭防火墙

1
2
3
4
5
查看:systemctl status firewalld.service

关闭:systemctl stop firewalld.service

永久关闭:systemctl disable firewalld.service

SSH

1
2
3
4
5
6
生成 ssh-keygen -t rsa
node1 操作:
ssh-copy-id node01
# 复制到其他主机
scp /root/.ssh/authorized_keys node02:/root/.ssh
scp /root/.ssh/authorized_keys node03:/root/.ssh

Mysql的安装

Centos7 环境下

1
2
3
4
5
6
# 下载并安装MySQL官方的 Yum Repository
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
# 使用上面的命令就直接下载了安装用的Yum Repository,大概25KB的样子,然后就可以直接yum安装了。
yum -y install mysql57-community-release-el7-10.noarch.rpm
# 之后就开始安装MySQL服务器。
yum -y install mysql-community-server
1
2
3
4
5
MySQL数据库设置
# 启动MySQL:
systemctl start mysqld.service
# 查看MySQL运行状态:
systemctl status mysqld.service
1
2
# 查看默认密码
grep "password" /var/log/mysqld.log

详细查看:https://www.cnblogs.com/luohanguo/p/9045391.html

重启Hadoop集群

1
2
3
4
5
sbin/stop-dfs.sh
sbin/stop-yarn.sh

sbin/start-dfs.sh
sbin/start-yarn.sh