Centos7网卡配置
cd /etc/sysconfig/network-scripts
# 在此目录下找到一个具有如下内容的文件 一般为 ifcfg-ens33 其中 ens33为网卡名
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
#BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
#IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=c656103e-e2e0-4d49-914f-00b7cbab9568
DEVICE=ens33
ONBOOT=yes
# 网络配置
BOOTPROTO=static # 静态ip
IPADDR=192.168.172.107 # ip地址
NETMASK=255.255.255.0 # 子网掩码
GATEWAY=192.168.172.1 # 网关
DNS1=8.8.8.8 # DNS
DNS2=192.168.172.1 # DNS
ZONE=public
systemctl restart network
firewall 相关操作
永久开启某个端口
firewall-cmd --zone=public --add-port=27017/tcp --permanent
永久关闭某个端口
firewall-cmd --remove-port=80/tcp --permanent
查看已开放的端口号
firewall-cmd --list-ports
重新加载防火墙
firewall-cmd --reload
tar zxvf cd
Centos7 配置yum为阿里源
1、备份原.repo文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下载新的.repo文件
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
CentOS 8
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
3、重构缓存
yum clean all
yum makecache
4、执行更新
yum update
临时开启docker端口
临时开启docker 端口
1. 获取容器ip地址
docker inspect <container_id> | grep IPAddress
2. nat转发
iptables -t nat -A DOCKER -p tcp --dport <host_port> -j DNAT --to-destination <container_ip>:<docker_port>
iptables -t nat -A POSTROUTING -j MASQUERADE -p tcp --source <container_ip> --destination <container_ip> --dport <docker_port>
iptables -A DOCKER -j ACCEPT -p tcp --destination <container_ip> --dport <docker_port>
3. 参数说明
container_ip:要做端口映射的容器ip
host_port:要映射到宿主机的端口
docker_port:要映射的端口,即容器中的端口
离线rpm包以及其依赖包
1、安装yumdownloader
yum install yum-utils -y
2、使用yumdownloader下载离线安装包
yumdownloader --resolve --destdir <path> <package>
# 其中 path代表下载的包存储路径,package代表要下载的包名
关闭selinux
Dockerfile构建时出现类似没有共享库权限的问题时,可以尝试关闭selinux
setenforce 0
# 永久关闭 修改/etc/sysconfig/selinux文件设置
sed -i 's/SELINUX=permissive/SELINUX=disabled/' /etc/sysconfig/selinux
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
elasticsearch安装及启动异常解决方式
elasticsearch.yml配置文件
bootstrap.memory_lockfalse
bootstrap.system_call_filterfalse
cluster.initial_master_nodes"node-1"
# 数据存储路径
path.data /xxx/xx/data
path.logs /xxx/xx/logs
network.host0.0.0.0
http.port9200
http.cors.enabledtrue
http.cors.allow-origin"*"
- max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
# 临时修改
sysctl -w vm.max_map_count=262144
# 永久修改
echo "vm.max_map_count=262144" >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf
- max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
vim /etc/security/limits.conf
# 添加以下内容 其中elastic是启动elasticsearch的用户名
elastic hard nofile 65536
elastic soft nofile 65536