Thingworx高可用集群部署(五)-InfluxDB安装

本文详细描述了如何进行服务器基础配置,包括关闭防火墙、调整SELinux、设置内核参数、配置YUM源、安装Linux工具、修改主机名、创建用户以及部署和管理InfluxDB数据库。
摘要由CSDN通过智能技术生成

主机: 10.10.10.77、10.10.10.78

服务器配置

关闭防火墙

setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld

配置内核参数

cat >> /etc/sysctl.conf <<EOF

#define
net.ipv4.tcp_syncookies = 1
fs.file-max = 1000000
vm.swappiness=10
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 120
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_max_tw_buckets = 20000
net.ipv4.tcp_max_syn_backlog = 8096
net.ipv4.ip_local_port_range = 1024 65000    # not for k8s
EOF

/sbin/sysctl -p

Limit参数

cat >>/etc/security/limits.conf<<EOF
root soft nproc 65535
root hard nproc 65535
root soft nofile 65535
root hard nofile 65535
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
EOF

sed -i 's/4096/65535/' /etc/security/limits.d/20-nproc.conf 

配置YUM源

vi /etc/yum.repos.d/epel.repo
[base]
name=CentOS-$releasever-Base-mirrors.trinasolar.com
failovermethod=priority
baseurl=http://mirrors.trinasolar.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.trinasolar.com/centos/RPM-GPG-KEY-CentOS-7

[updates]
name=CentOS-$releasever-Updates-mirrors.trinasolar.com
failovermethod=priority
baseurl=http://mirrors.trinasolar.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.trinasolar.com/centos/RPM-GPG-KEY-CentOS-7

安装Linux工具

yum install -y sysstat-*x86_64 
yum install -y unzip
yum install -y gzip 
yum install -y zip 
yum install -y tar 
yum install -y wget
yum install -y lrzsz 
yum install -y twm 
yum install -y xterm 
yum install -y xhost 
yum install -y pixman 
yum install -y pixman-devel 
yum install -y libXfont 
yum install -y fio 
yum install -y ntp 
yum install -y telnet 
yum install -y bc 
yum install -y dos2unix 
yum install -y net-tools 
yum install -y iperf 
yum install -y iftop 
yum install -y iotop 
yum install -y psmisc 
yum install -y lsof 
yum install -y nethogs 
yum install -y htop
yum install -y wget

修改主机名

hostnamectl --static set-hostname testpg01
cat >> /etc/hosts << EOF
10.10.10.77 tsczetinf01
EOF
cat >> /etc/hosts << EOF
10.10.10.78 tsczetinf02
EOF

创建主机用户

useradd influxdb && echo 'Influx#2024' | passwd --stdin influxdb
sed -i 'N;100a\influxdb    ALL=(ALL)    ALL' /etc/sudoers
chage -M 99999 influxdb

部署influxdb

配置yum源

cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF

安装Influxdb

yum install influxdb -y

mkdir /data/influxdb/{meta,data,wal} -p
chown influxdb.influxdb /data/influxdb -R

修改配置文件

vi /etc/influxdb/influxdb.conf

bind-address = ":8088"
dir = "/data/influxdb/meta"

dir = "/data/influxdb/data"
wal-dir = "/data/influxdb/wal"
wal-fsync-delay = "10ms"
index-version = "tsi1"

write-timeout = "10s"

http

enabled = true
flux-log-enabled = false
bind-address = ":8086"
log-enabled = true

level = "info"

启动

systemctl enable influxdb
systemctl start influxdb
systemctl status influxdb

修改系统服务文件(非必须)

[Unit]
Description=influx-cluster
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/influxd -config /etc/influxdb/influxdb.conf
Restart=on-failure

[Install]
WantedBy=multi-user.target

创建用户

influx -port 8086         --登录
create database thingworx --创建库
create user thingworx with password 'TW_admin@2022_TH' with all privileges -- 创建用户

  • 8
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值