Linux 用户打开线程过多问题排查
现象描述
Linux 切换登录失败
su: /bin/bash: Resource temporarily unavailable
问题分析
Linux用户默认有打开线程限制,查看配置文件/etc/security/limits.d/20-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 4096
root soft nproc unlimited
查看用户到底是哪些程序创建了那么多线程:
ps h -Led |awk '{print $1}'|uniq -c |grep -v ' 1' |sort -nr
grafana 搭建
软件下载和安装
https://grafana.com/grafana/download?platform=linux
wget https://dl.grafana.com/oss/release/grafana-6.1.3-1.x86_64.rpm
sudo rpm -ivh grafana-6.1.3-1.x86_64.rpm
sudo /sbin/chkconfig --add grafana-server
sudo service grafana-server start
web页面:http://localhost:3000 登录用户 admin / admin
# 安装用于支持显示的字体
sudo yum install fontconfig
sudo yum install freetype*
sudo yum install urw-fonts
# [InfluxDB 安装](https://www.cnblogs.com/mafeng/p/6848166.html)
https://www.influxdata.com/downloads/#influxdb
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.7.5.x86_64.rpm
sudo yum localinstall influxdb-1.7.5.x86_64.rpm
sudo service influxdb start
配置文件路径 :/etc/influxdb/influxdb.conf
先把数据库存储目录修改掉:
sudo mkdir /data/influxdb && sudo chown influxdb:influxdb /data/influxdb
InfluxDB
使用命令 influx -precision rfc3339
通过 http://localhost:8086
地址连接influxDB 数据库。-precision rfc3339
可以格式化显示日期。
Time series have zero to many points, one for each discrete sample of the metric. Points consist of time (a timestamp), a measurement (“cpu_load”, for example), at least one key-value field (the measured value itself, e.g. “value=0.64”, or “temperature=21.2”), and zero to many key-value tags containing any metadata about the value (e.g. “host=server01”, “region=EMEA”, “dc=Frankfurt”).
数据库和用户管理
create database grafana;
CREATE USER grafana WITH PASSWORD 'Paic1234';
GRANT ALL PRIVILEGES TO grafana
SET PASSWORD FOR grafana = 'Paic1234';
SHOW GRANTS FOR grafana
show users;
vi /etc/influxdb/influxdb.conf
auth-enabled=true
测试用户登录
influx -username grafana -password Paic1234
-- 数据查询工具
show databases show database names
show series show series information
show measurements show measurement information
show tag keys show tag key information
show field keys show field key information
--query
> select * from cpu limit 10;
> SELECT mean("usage_user") AS "system" FROM "grafana"."cpu" WHERE ("host" = 'datanode3') limit 10
telegraf
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.10.2-1.x86_64.rpm
sudo yum localinstall telegraf-1.10.2-1.x86_64.rpm
自动生成配置,也可以参考默认的配置文件进行配置(默认配置文件更加齐全):
telegraf --input-filter cpu:mem:disk:diskio:net --output-filter influxdb:opentsdb config > /etc/telegraf/telegraf.d/system.conf
修改配置文件中InfluxDB配置
service telegraf restart
Gitlab
下载,配置,启动
http://x.x.x.x/users/sign_in
root / Paic1234
centos6.6环境搭建 github unable to access SSL connect error出错处理
问题
克隆github项目出现SSL connect error
git clone https://github.com/creationix/nvm
Cloning into ‘nvm’…
fatal: unable to access ‘https://github.com/creationix/nvm/’: SSL connect error
原因
ssl证书可能过期了
解决方案
yum update -y nss curl libcurl
Jenkins
需要安装git,maven等插件
http://x.x.x.x:8081/jenkins/updateCenter/
admin / Paic1234
新建maven项目
进行构建