副问题[/!--empirenews.page--]
1、Nginx
营业配景
现公司需求快速搭建web处事器,对外提供应用户web处事。
需求拆分
必要基于http协议的软件,搭建处究竟现
先容
常见用法:
1) web处事器软件 httpd http协议
同类的web处事器软件:apache(老牌) nginx(俄罗斯) IIS(微软)
2)署理处事器 反向署理
3)邮箱署理处事器 IMAP POP3 SMTP
4)负载平衡成果 LB loadblance
Nginx架构的特点:
- ①高靠得住:不变性 master历程 打点调治哀求分发到哪一个worker=> worker历程 相应哀求 一master多worker②热陈设 :(1)滑腻进级 (2)可以快速重载设置③高并发:可以同时相应更多的哀求 变乱 epoll模子 几万④相应快:尤其在处理赏罚静态文件上,相应速率很快 sendfile⑤低耗损:cpu和内存 1w个哀求 内存2-3MB⑥漫衍式支持 :反向署理 七层负载平衡
官方网址:http://nginx.org/

1.2、安装
常见安装方法:
①yum安装设置,需行使Nginx官方源可能EPEL源②源码编译
- #添加运行用户
- shell > useradd -s/sbin/nologin -M www
- #安装依靠
- shell > yum -y install pcre-devel zlib-devel openssl-devel
- #编译安装
- shell > cd /root/soft
- shell > tar xvf nginx-1.14.2.tar.gz
- shell > cd nginx-1.14.2
- shell > ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module && make && make install
编译参数声名

1.3、目次先容
查察安装目次/usr/local/nginx
1.4、软件操纵参数
查察nginx的二进制可执行文件的相干参数
- shell > cd /usr/local/nginx/sbin
- shell > ./nginx -h
执行后表现
- nginx version: nginx/1.14.2
- Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
-
- Options:
- #查察辅佐
- -?,-h : this help
- #查察版本并退出
- -v : show version and exit
- #查察版本和设置选项并退出
- -V : show version and configure options then exit
- #检测设置文件语法并退出
- -t : test configuration and exit
- #检测设置文件语法打印它并退出
- -T : test configuration, dump it and exit
- #在设置测试时代榨取表现非错误信息
- -q : suppress non-error messages during configuration testing
- #发送信号给主历程 stop逼迫退出 quit优雅的退出 reopen重开日记 reload重载设置
- -s signal : send signal to a master process: stop, quit, reopen, reload
- #配置nginx目次 $prefix路径
- -p prefix : set prefix path (default: /usr/local/nginx/)
- #指定启动行使的设置文件
- -c filename : set configuration file (default: conf/nginx.conf)
- #在设置文件之外配置全局指令
- -g directives : set global directives out of configuration file
一样平常首要行使:
- -s参数节制打点nginx处事-V参数查察nginx开启的模块和编译参数-t参数检测设置文件是否有错误
2、Keepalived实现高可用
营业配景
单例web处事器可以或许满意营业根基需求,提供web处事。可是,存在单点妨碍的题目,即当处事器宕机后,用户将无法获取随处事相应。
为了可以或许进步用户体验度,可以或许一连得给用户提供优质的处事,当web处事器不行用时,可以有备用处事器接替web处事器的事变,继承为用户提供相应。个中,还要办理一个题目,必要备用处事器可以或许快速自动切换过来。
一样平常将以上营业需求,称为实现处事的高可用HA。
需求拆分
也就是高可用的实现焦点:
①冗余处事器(备份处事器)
(编辑:湖南网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|