首页 文章 精选 留言 我的

精选列表

搜索[centos],共5636篇文章
优秀的个人博客,低调大师

CentOS6.9安装Logstash

一、下载地址 官网:https://www.elastic.co/cn/downloads/logstash 百度云盘: 二、安装 tar zxvf logstash-6.2.1.tar.gz mv logstash-6.2.1 logstash 配置文件(配置文件放哪个目录都可以,在启动Logstash时可以指定配置文件位置) vi k_es.conf input{ kafka { bootstrap_servers => "10.10.6.225:9092" #kafka服务器地址,不是zookeeper client_id => "test" auto_offset_reset => "latest" consumer_threads => 5 decorate_events => true topics => ["test"] #控制kafka哪个topic,可以多个用逗号分割 codec => "json" } } filter{ json { source => "message" remove_field=>["message","beat","@version"] #删除没用的属性 add_field =>["customize","自定义字段"] #增加属性 } } output { elasticsearch { hosts => "localhost:9200" index => "logstash-nginxacclog-%{+YYYY.MM.dd}" #放到elasticsearch哪个index中 } } 启动(到bin目录下) ./logstash -f k_es.conf 后台运行 nohup /usr/local/logstash/bin/logstash -f /usr/local/logstash/bin/k_es.conf -w 8 -b 1000> /dev/null 2>&1 & 配置文件备份 input{ kafka { bootstrap_servers => "10.100.2.210:9092" client_id => "nginxaccesslog" auto_offset_reset => "latest" consumer_threads => 5 decorate_events => true topics => ["nginx_access_log"] codec => "json" type => "nginx_log" } kafka { bootstrap_servers => "10.100.2.210:9092" client_id => "database" auto_offset_reset => "latest" consumer_threads => 5 decorate_events => true topics => ["t_resource_info","t_base_person","t_base_organization","t_base_student","t_base_parent","t_base_class"] codec => "json" type => "dsideal_db" } kafka { bootstrap_servers => "10.100.2.210:9092" client_id => "devops_real" auto_offset_reset => "latest" consumer_threads => 5 decorate_events => true topics => ["devopsrealinfo"] codec => "json" type => "devopsrealinfo" } kafka { bootstrap_servers => "10.100.2.210:9092" client_id => "devops_base" auto_offset_reset => "latest" consumer_threads => 5 decorate_events => true topics => ["devopsbaseinfo"] codec => "json" type => "devopsbaseinfo" } } filter{ mutate { gsub => ["message", "\\x22", '"'] } json { source => "message" remove_field=>["message","beat","@version"] } if [type] == "nginx_log" { geoip { source => "ip" target => "geoip" database => "/usr/local/GeoLite2-City.mmdb" } } } output { if [type] == "nginx_log" { elasticsearch { hosts => "10.100.2.210:9200" index => "nginx-access-log" } } if [type] == "dsideal_db" { elasticsearch { hosts => "10.100.2.210:9200" index => "%{table_name}" document_id => "%{id}" } } if [type] == "devopsbaseinfo" { elasticsearch { hosts => "localhost:9200" index => "devopsbaseinfo" document_id => "%{id}" } } if [type] == "devopsrealinfo" { elasticsearch { hosts => "localhost:9200" index => "devopsrealinfo" } } }

优秀的个人博客,低调大师

centos7安装supervisor

其实现在网络上supervisor的教程有很多,比较杂,我找了几个对我来说是有帮助的教程,再结合自己的理解做一些笔记,可以供自己以后翻看。 链接:https://www.cnblogs.com/Hai--D/p/5820718.html http://blog.csdn.net/xyang81/article/details/51555473 有时候在linux上的程序还是需要统一管理,这时候supervidor就非常好用,在windowns上操作就非常好。 首先: 一、安装supervisor 1.wget https://pypi.python.org/packages/80/37/964c0d53cbd328796b1aeb7abea4c0f7b0e8c7197ea9b0b9967b7d004def/supervisor-3.3.1.tar.gz 2.tar zxf supervisor-3.3.1.tar.gz 3.cd supervisor-3.3.1 4.python setup.py install 如果报错可能: 提示setuptools-0.6c11.tar没有安装 下载https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz tar zxf setuptools-0.6c11.tar.gz cd setuptools-0.6c11/ python setup.py build python setup.py install 提示下载错误,需meld3>0.6.5 下载http://dl.fedoraproject.org/pub/epel/7/x86_64/p/python-meld3-0.6.10-1.el7.x86_64.rpm(或者我备份了一份) 安装 rpm -ivhpython-meld3-0.6.10-1.el7.x86_64.rpm 如下提示,安装完成: Using /usr/lib64/python2.7/site-packages Finished processing dependenciesforsupervisor==3.3.1 二、配置supervisor 1.创建文件夹和配置文件 mkdir /etc/supervisor echo_supervisord_conf > /etc/supervisor/supervisord.conf 2.修改 /etc/supervisor/supervisord.conf 文件 先新建 mkdir /etc/supervisor/conf.d 以后程序的配置都在这个文件夹里面,以 .ini结尾 修改files的路径为上图所示。这样配置后,会读取conf.d中的文件。 3. supervisorctl reload使配置文件生效 4.在conf.d中创建****.ini文件,创建完毕后 supervisorctl update使之生效 ini文件中,可以按照以下配置,以下是我某个程序的配置,你要怎么配置可以看这篇文件:http://blog.csdn.net/xyang81/article/details/51555473 其实也就是supervisord.conf配置中的解读,网上还有更加详细的说明,问度娘。 [program:hsparser2] command=python main_2.py process_name=hsparser2-%(process_num)s numprocs=10 directory=/home/hsparser2/ autostart=true autorestart=unexpected redirect_stderr=true 保存退出即可。 5.配置有界面的supervisor来监控程序的运行状态 保存退出即可,然后在你的windows上,输入你服务器的ip:9001就可以看到如下图: 这样你就配置好你的程序在supervisor上了,大功告成。 三、问题注意: 1.如果出现以下问题 可能是由于supervisord进程停止了,建议重新运行 运行此命令:supervisord -c /etc/supervisor/supervisord.conf

优秀的个人博客,低调大师

Centos6.5安装dnsmasq

1、使用yum install dnsmasq -y安装dns(含dns server和dns代理功能) 2、查询dnsmasq已经安装成功 [root@localhost ~]#rpm -q dnsmasq dnsmasq-2.48-18.el6_9.x86_64 [root@localhost ~]# 3、配置/etc/dnsmasq.conf文件 对于/etc/dnsmasq.conf文件的行太多的话,我们只需要添加我们需要的行,先把所有行都注释掉,然后echo追加进去我们所需要的行。 3.1、修改/etc/dnsmasq.conf的快速方法:在每行的头添加字符,比如"#",注释掉文件的所有行,命令如下: sed -i 's/^/#&/g' /etc/dnsmasq.conf //注释掉/etc/dnsmasq.conf文件中的所有的行 cat /etc/dnsmasq.conf |grep -v "#"//查看注释是否OK 3.2、然后把需要的行echo追加进去 echo resolv-file=/etc/resolv.dnsmasq.conf>>/etc/dnsmasq.conf#此/etc/resolv.dnsmasq.conf文件还需后续编辑 echo strict-order >>/etc/dnsmasq.conf echo interface=eth0 >>/etc/dnsmasq.conf #对特定接口提供dns服务 echo addn-hosts=/etc/dnsmasq.hosts>>/etc/dnsmasq.conf #此/etc/dnsmasq.hosts文件还需后续编辑 [root@localhost ~]#cat /etc/dnsmasq.conf |grep -v "#"//查看echo是否追加ok resolv-file=/etc/resolv.dnsmasq.conf strict-order interface=eth0 #对特定接口提供dns服务 addn-hosts=/etc/dnsmasq.hosts [root@localhost ~]# ////////sed -i 's/^#//' 123.txt //删除文件的行首字符# 注意 要加-i才能修改文件生效 ////////sed -i 's/^/#&/g' 123.txt //每行添加行首字符# 注意 要加-i才能修改文件生效 4、编辑配置文件 4.1编辑/etc/resolv.dnsmasq.conf配置文件 cp /etc/resolv.conf /etc/resolv.dnsmasq.conf [root@localhost ~]#vim /etc/resolv.dnsmasq.conf nameserver 8.8.8.8 [root@localhost ~]# 4.2编辑/etc/dnsmasq.hosts配置文件 cp /etc/hosts /etc/dnsmasq.hosts [root@localhost ~]#vim /etc/dnsmasq.hosts 127.0.0.1localhost.localdomain localhost ::1localhost6.localdomain6 localhost6 135.251.214.2 RMS.chinamobile.com *.chinamobile.com #劫持域名映射到135.251.214.2 5、service dnsmasq restart 启动服务 [root@Apache zfp]#service dnsmasq start Starting dnsmasq: [确定] [root@Apache zfp]# [root@Apache zfp]# service dnsmasq status dnsmasq (pid 1139) 正在运行... [root@Apache zfp]# 6、查看53端口监听状态 [root@localhost ~]#netstat -tunlp |grep 53 tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 2465/dnsmasq tcp 0 0 :::53 :::* LISTEN 2465/dnsmasq udp 0 0 0.0.0.0:53 0.0.0.0:* 2465/dnsmasq udp 0 0 :::53 :::* 2465/dnsmasq [root@localhost ~]# 7、设置随系统启动dnsmasq服务 [root@localhost ~]#chkconfig dnsmasq on//随linux系统启动dnsmasq服务 [root@localhost ~]#chkconfig --list |grep dnsmasq//查看是否设置成功 dnsmasq 0:关闭1:关闭2:启用3:启用4:启用5:启用6:关闭 [root@localhost ~]# --------End Of Text-------

优秀的个人博客,低调大师

CentOS搭建自己的SS

服务器:Vultr官网链接 基本步骤: 注册账号 添加信用卡或paypel充值(注意:如果网页自动翻译,可能看不到paypel充值页面,选择重新载入然后拒绝翻译就好) 选择服务器主机,购买。我买的时候最低配置的2.5美元的已经没有了,据说这个就够了,我用的5美元版本 -选择服务器机房地址 -选择套餐(实际上是按照时间计费的) -然后点击右下角的”Deploy Now”就好 服务器系统:Cent 6 x64(尽量不要选择7以上版本哦) 然后开始部署啦! SSH连接服务器 ssh root@ip地址 密码是系统给的密码哦,如果需要,可以重置。会方便许多。 passwd - 开始部署SS,代码如下 yum -y install wget wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-libev.sh chmod +x shadowsocks-libev.sh ./shadowsocks-libev.sh 2>&1 | tee shadowsocks-libev.log 卸载命令:./shadowsocks-libev.sh uninstall 注意中途要输入密码和端口哦~成功后如下: 记得重启哦~ 重启命令行 reboot 部署加速 yum -y install wget wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh chmod +x bbr.sh ./bbr.sh 成功后如下: 参考:https://github.com/Alvin9999/new-pac/wiki/%E8%87%AA%E5%BB%BAss%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%95%99%E7%A8%8B

优秀的个人博客,低调大师

CentOS下几个压缩命令

经常在使用linux过程中碰到加压或者解压忘记命令,今天总结一下: 1,首先是bzip2类型的,这种类型比较少,通常是.bz2后缀,但是偶尔也会碰到: bzip2 + 文件名 //压缩文件 bzcat 压缩文件名 //查看压缩文件内容 bzip2 -d xxx.bz2 //解压 2,tar类型的,基本上大多数是这种类型的: 1 .tar.bz2后缀的压缩包 tar -jcvf xxx.tar.bz2 要压缩的文件名 //压缩命令,.tar.bz2后缀 tar -jtvf xxx.tar.bz2 //查看压缩文件内容 tar -jxvf xxx.tar.bz2 -C 目录路径 //解压 2 tar.gz后缀的压缩包 tar -zcvf xxx.tar.gz 要压缩的文件名 //压缩命令 tar -ztvf xxx.tar.gz //查看压缩文件内容 tar -zxvf xxx.tar.gz -C 解压目录 //解压到指定目录,如果没有-C 解压到当前目录 3 tar后缀 tar -xvf 文件名 //解压,一般用不着加压 3, rar 后缀 rar a xxx.rar 要压缩的文件名 //压缩。 注意:这个要装rar,和unrar才能使用这个命令 unrar e xxx.tar //解压 4,zip后缀 zip xxx.zip 要压缩的文件 //压缩 unzip xxx.zip //解压

优秀的个人博客,低调大师

centos7配置dhcp

用su 获取root权限 用yum -y install dhcp命令安装dhcp服务(yum是基于RPM包管 理,自动下载RPM包并且安装) 查看安装后生成的配置文件 rpm -qc dhcp 编辑dhcp的配置文件 vim /etc/dhcp/dhcpd.conf option domain-name "example.org"; option domain-name-service ns1.example.org; default-lease-time 600; max-lease-time 7200; authoritative; subnet 10.0.2.0 netmask 255.255.255 .0{ range 10.0.2.10 10.0.2.200; option domain-name-service ns1.internal.example.org; option domain-name "internal.example.org"; option routers 10.0.2.254; option broadcast-address 10.0.2.255; default-lease-time 600; max-lease-time 7200;} host passacaglia{ hardware ethernet 08:00:27:54:9d:67; fixed-address 10.0.2.55; } 全局配置详情: authoritative: 指定当一个客户端试图获得一个不是该DHCP服务器分配的IP信息,DHCP将发送一个拒绝消息,而不会等待请求超时。当请求被拒绝,客户端会重新向当前DHCP发送IP请求获得新地址,当网络中有其他的DHCP服务器时,加上此参数可以忽略其他DHCP服务器。可把此参数加在dhcp.conf配置文件的第一行。 default-lease-time: 设置默认租约时间,参数值单位是秒。默认租约时间表示客户端从服务器租用一个IP地址的默认时间,到大时间后客户端会向服务器提出继续租用该IP地址的请求。 max-lease-time: 设置最大租约时间,参数值单位是秒。当客户端租约的地址到大这个时间,就不能继续租用该IP地址。 option domain-name: 设置主机所在域的名称,设置的域名和主机名称一起组成主机全名。 option domain-name-service :设置DNS服务器地址,设置后客户机DNS会使用该地址,如果要设置多个DNS地址,用逗号隔开。 使用subnet声明设置子网属性 subnet后面设置网络地址,尾数范围最好在0-24之间,netmask后面设置子网掩码。 range参数:是设置subnet中可供动态分配的IP地址范围,参数值一定要是subnet设置的子网之内,否则不能启动。 subnet-mask参数:设置子网掩码,设置子网掩码之后一般不需要再设置网络地址和广播地址。 routers参数:是设置默认网关。 使用host声明设置主机属性,通常用于为服务器分配好固定使用的IP地址 host: 后面需要为DHCP客户端主机设置主机名称。 hardware:是设置客户端主机的物理地址(MAC地址),因为通常使用的都是以太网,所以hardware参数类型设置为ethernet。 fixed-address:设置在host声明中指定的客户端分配固定使用的IP地址。 启动dhcp服务 systemctl start dhcpd.service 登录客户机查看是否为分配的ip 注意事项 每次启动dhcp服务前,需要启动网卡服务,systemctl start network.service 修改完客户机分配ip,也需要重启客户机的网卡来重获ip

资源下载

更多资源
Apache Tomcat

Apache Tomcat

Tomcat是Apache 软件基金会(Apache Software Foundation)的Jakarta 项目中的一个核心项目,由Apache、Sun 和其他一些公司及个人共同开发而成。因为Tomcat 技术先进、性能稳定,而且免费,因而深受Java 爱好者的喜爱并得到了部分软件开发商的认可,成为目前比较流行的Web 应用服务器。

Eclipse

Eclipse

Eclipse 是一个开放源代码的、基于Java的可扩展开发平台。就其本身而言,它只是一个框架和一组服务,用于通过插件组件构建开发环境。幸运的是,Eclipse 附带了一个标准的插件集,包括Java开发工具(Java Development Kit,JDK)。

JDK

JDK

JDK是 Java 语言的软件开发工具包,主要用于移动设备、嵌入式设备上的java应用程序。JDK是整个java开发的核心,它包含了JAVA的运行环境(JVM+Java系统类库)和JAVA工具。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。