Nginx负载均衡集群介绍
第1章 集群介绍
1.1 集群简介
1.1.1 什么是集群
简单说,集群就是一组(若干个)相互独立的计算机,利用高速通信网络组成的一个较大的计算机服务系统,每个集群节点(即集群中的每台计算机)都是运行各自服务的独立服务器,这些服务器之间可以彼此通信,协同向用户提供应用程序,系统资源和数据,并以单一系统的模式加以管理。当用户客户机请求集群系统时,集群给用户的感觉就是一台服务器干一件事。
1.2 集群的优势特点
高性能(performance)
一些国家重要的计算密集型应用(如天气预报,核试验模拟等),需要计算机有很强的计算处理能力。以全世界现有的技术,即使是大型机,其计算能力也是有限的,很难单独完成此任务。因为计算时间可能会相当长,也许几天,甚至几年或更久。因此,对于这类复杂的计算业务,便使用了计算机集群技术,集中有几十甚至上百台计算机进行计算。
高可用(availability)
单一的计算机系统总会面临设备损毁的问题,例如:CPU,内存,主板,电源,硬盘等,只要一个部件坏掉,这个计算机系统就有可能会宕机,无法正常提供服务。在集群系统中,尽管硬件和软件也还是会发生故障,但整个系统的服务可以是每天24*7可用的。
数据不能丢
网站7*24不宕机
用户的体验好
高可用性集群常用的开源软件包括keepalived,heartbeat等。
1.3 集群的分类
计算机集群架构按功能和结构可以分成以下几类:
负载均衡集群(load balancing clusters),简称LBC或LB.
高可用性集群(HIGH-availability(HA)clusters),简称HAC.
高性能计算集群(High-performance(HPC)clusters),简称HPC。
网格计算(grid computing)
提示:负载均衡和高可用性集群是互联网行业常用的集群架构模式。
负载均衡集群的作用为:
分担用户访问请求及数据流量(负载均衡)。
保持业务连续性,即7*24小时服务(高可用性)
应用于web业务及数据库从库(读)等服务器的业务。
负载均衡集群典型的开源软件包括LVS,Nginx,Haproxy等
1.4 常见的集群软硬件介绍
互联网企业常用的开源集群软件有:Nginx(7 [v1.9] 4),LVS(4层),haproxy(4,7),keepalived,heartbeat.
应用层(http HTTPS)
传输层(tcp)
互联网企业常用的商业集群硬件有:F5,netscaler,radware,A10等,工作模式相当于haproxy的工作模式。
淘宝,赶集网,新浪等公司曾使用过Netscaler负载均衡产品。
当企业业务重要,技术力量有薄弱,并且希望出钱购买产品及获取更好的服务时,可以选择硬件负载均衡产品,如F5,Netscaler,Radware等,此类公司多为传统的大型非互联网企业,如银行,证券,金融,宝马,奔驰等。
对于门户网站来说,大多会并用软件及硬件产品来分担单一产品的风险,如淘宝,腾讯,新浪等。融资了的企业会购买硬件产品,如赶集网等网站。
中小型互联网企业,由于起步阶段无利润可赚或利润很低,会希望通过使用开源免费的方案来解决问题,因此会雇佣专门的运维人员进行维护。
第2章 Nginx负载均衡集群介绍
2.1 反向代理与负载均衡概念简介
严格的说,nginx仅仅是作为nginxproxy反向代理使用的,因为这个反向代理功能表现的效果是负载均衡的效果,所以本文称之为nginx负载均衡。那么反向代理和负载均衡有什么区别?
普通负载均衡软件,例如大名鼎鼎的LVS,其实现的功能只是对请求数据包的转发(也可能会改写数据包),传递,其中DR模式明显的特征是从负载均衡下面的节点服务器来看,接收到的请求还是来自访问负载均衡器的客户端的真实用户,而反向代理就不一样了,反向代理接受访问用户的请求后,会代理用户重新发起请求代理下的节点服务器,最后把数据返回给客户端用户,在节点服务器看来,访问的节点服务器的客户端用户就是反向代理服务器了,而非真实的网站访问用户。
2.2 负载均衡演示
2.2.1 web服务器上配置站点
2.2.1.1web服务器上配置站点,操作前先备份
[root@web01 ~]# cp/application/nginx/conf/nginx.conf{,.bak.lb}
2.2.1.2创建配置文件
vim/application/nginx/conf/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
log_format main '$remote_addr - $remote_user [$time_local]"$request" '
'$status $body_bytes_sent"$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server {
listen 80;
server_name www.etiantian.org;
location / {
root html/www;
index index.html index.htm;
}
access_log logs/access_www.log main;
}
server {
listen 80;
server_name bbs.etiantian.org;
location / {
root html/bbs;
index index.html index.htm;
}
access_log logs/access_bbs.log main;
}
}
2.2.1.3创建站点并追加内容到站点目录主页内容
mkdir -p/application/nginx/html/{www,bbs}
for dir in www bbs;do echo"`ifconfig eth0|egrep -o "10.0.0.[0-9]+"` $dir">/application/nginx/html/$dir/bingbing.html;done
2.2.1.4检查语法并重启服务
/application/nginx/sbin/nginx -t
/application/nginx/sbin/nginx -s reload
2.2.1.5lb01 上面进行测试
curl 10.0.0.7/bingbing.html
curl 10.0.0.8/bingbing.html
curl 10.0.0.9/bingbing.html
2.2.2 负载均衡服务器上配置服务
2.2.2.1在负载均衡lb01上配置配置文件()
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstreamserver_pools {
server 10.0.0.7;
server 10.0.0.8;
server 10.0.0.9;
}
server {
listen 80;
server_name www.etiantian.org;
location / {
proxy_pass http://server_pools;
}
}
}
注:多台负载均衡都要配置upstream服务器地址池。
2.2.2.2重启配置文件
[root@lb01 conf]# /application/nginx/sbin/nginx-t
nginx: the configuration file/application/nginx-1.10.2/conf/nginx.conf syntax is ok
nginx: configuration file/application/nginx-1.10.2/conf/nginx.conf test is successful
[root@lb01 conf]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODENAME
nginx 4717 root 6u IPv4 16704 0t0 TCP *:http (LISTEN)
nginx 4719 www 6u IPv4 16704 0t0 TCP *:http (LISTEN)
[root@lb01 conf]#/application/nginx/sbin/nginx -s reload
2.2.2.3测试结果
[root@lb01-05 conf]# curl10.0.0.5/bingbing.html
10.0.0.9
10.0.0.255 www
[root@lb01-05 conf]# curl10.0.0.5/bingbing.html
10.0.0.7
10.0.0.255 www
[root@lb01-05 conf]# curl10.0.0.5/bingbing.html
10.0.0.8
10.0.0.255 www
第3章 负载均衡模块说明
nginx http 功能模块 | 模块说明 |
ngx_http_proxy_module | proxy代理模块,用于把请求后抛给服务器节点或upstream 服务器池。 |
ngx_http_upstream_module | 负载均衡模块,可以实现网站的负载均衡功能及节点的健康检查,创建一个池子,web服务器。 |
3.1 Nginxupstream模块
nginx的负载均衡功能依赖于ngx_httpstream_module模块,所支持的代理方式包括proxy_pass,fastcgi_pass,memcached_pass等,新版nginx软件支持的方式有所增加。
ngx_http_upstream_module模块允许nginx定义一组或多组节点服务器组,使用时可以通过proxy_pass代理方式把网站的请求发送到实现定义好的对应的upstream组的名字上,具体写法为“proxy_pass http://www_server_pools”,其中www_server_pools就是一个upstream节点服务器组的名字。
3.1.1 upstream的server标签参数说明
server标签 | 参数说明 |
server 10.0.0.8:80 | 负载均衡后面的RS配置,可以是IP或域名,如果端口不写,默认是80端口。高并发场景下,IP可以换成域名,通过DNS做负载均衡。 |
weight=1 | 代表服务器的权重,默认值是1.权重数字越大表示接受的请求比例越大。 |
max_fails=1 | nginx尝试连接后端主机的次数,这个数值是配合proxy_next_upstream,fastcgi_next_upstream和memcached_next_upstream这三个参数来使用,当nginx接收后返回这三个参数定义的状态码时,会将这个请求转发给正常工作的后端服务器,列如404,502,503,max_fails的默认值是1;企业场景:建议2-3次,京东1次,蓝汛10次(CDN),根据业务需求去配置。 |
fail_timeout=10s | 在max_fails定义的失败次数后,距离下次检查的间隔时间,默认是10s,如果max_fails是5,它就检测5次,如果5次都是502。那么,他就会根据fail_timeout的值,等待10s再去检查,还是只检查一次,如果持续502,在不重新加载nginx配置的情况下,每隔10s都只检测一次,常规业务2-3秒比较合理,比如京东3秒,蓝汛3秒,可根据业务需求去配置。 |
backup | 热备配置(RS节点的高可用),当前面激活的RS都失败后会自动启用热备RS,这标志这个服务器作为备份服务器,若主服务器全部宕机了,就会向他转发请求;注意,当负载调度算法为ip_hash时,后端服务器在负载均衡调度中的状态不能使weight和backup。 |
3.1.1.1nginx upstream weight标签测试
操作前备份
[root@lb01 ~]# cd/application/nginx/conf/
[root@lb01 conf]# pwd
/application/nginx/conf
[root@lb01 conf]# hostname
lb01
[root@lb01 conf]# cpnginx.conf{,.bak.before.upsteam}
[root@lb01 conf]# cat nginx.conf
修改配置文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstreamserver_pools {
server 10.0.0.7:80weight=2;
server 10.0.0.8:80weight=1;
server 10.0.0.9:80weight=1;
}
server {
listen 80;
server_name www.etiantian.org;
location / {
proxy_pass http://server_pools;
}
}
}
检查语法并重启
/application/nginx/sbin/nginx -t
lsof -i:80
/application/nginx/sbin/nginx
测试结果
curl 10.0.0.5/bingbing.html
for i in {1..10};do curl10.0.0.5/bingbing.html;done
3.1.1.2nginx upstream max_fails和 fail_timeout标签测试
修改配置文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream server_pools {
server 10.0.0.7:80 weight=4 max_fails=3 fail_timeout=30s;
server 10.0.0.8:80 weight=4 max_fails=3 fail_timeout=30s;
# server 10.0.0.9:80 weight=1;
}
server {
listen 80;
server_name www.etiantian.org;
location / {
proxy_pass http://server_pools;
}
}
}
测试结果:
for n in {1..1000};do curl -s 10.0.0.5/bingbing.html|grep"[78]$";sleep 1;date +%T;done
sed -i 'N;s#\n10.0.0.255# #g'/application/nginx/html/{www,bbs}/bingbing.html
3.1.1.3nginx upstream backup标签 测试
修改配置文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream server_pools {
server 10.0.0.7:80 weight=4 max_fails=3fail_timeout=30s;
server 10.0.0.8:80 weight=4 max_fails=3 fail_timeout=30s;
server 10.0.0.9:80 weight=4 max_fails=3fail_timeout=30s backup;
}
server {
listen 80;
server_name www.etiantian.org;
location / {
proxy_pass http://server_pools;
}
}
}
3.2 upstream模块调度算法
调度算法一般分为两类,第一类为静态调度算法,即负载均衡器根据自身设定的规则进行分配,不需要考虑后端节点服务器的情况,例如:rr,wrr,ip_hash等都属于静态调度算法。
第二类为动态调度算法,即
3.2.1 WRR权重轮询
3.2.2 RR轮询
3.2.3 IP_hash(静态调度算法)
3.2.4 least_conn
#####nginx.conf 多个虚拟主机
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream server_pools {
server 10.0.0.7:80 weight=4max_fails=3 fail_timeout=30s;
server 10.0.0.8:80 weight=4max_fails=3 fail_timeout=30s;
server 10.0.0.9:80 weight=4max_fails=3 fail_timeout=30s;
}
server {
listen 80;
server_name www.etiantian.org;
location / {
proxy_pass http://server_pools;
proxy_set_header Host $host;
}
}
server {
listen 80;
server_name bbs.etiantian.org;
location / {
proxy_pass http://server_pools;
proxy_set_header Host $host;
}
}
}
注:多个虚拟主机设置主机头:因为一个web服务器中可能有很多的虚拟主机站点,如果使用IP地址访问时,默认每次访问都会到达第一个站点,此时如果加上主机头,访问一个web网站的时候,会有针对性的访问带有的主机头的虚拟主机。
X-Forwarded-For
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream server_pools {
server 10.0.0.7:80 weight=4max_fails=3 fail_timeout=30s;
server 10.0.0.8:80 weight=4max_fails=3 fail_timeout=30s;
server 10.0.0.9:80 weight=4max_fails=3 fail_timeout=30s;
}
server {
listen 80;
server_name www.etiantian.org;
location / {
proxy_pass http://server_pools;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
server {
listen 80;
server_name bbs.etiantian.org;
location / {
proxy_pass http://server_pools;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
}
##
##根据用户请求的url目录(URI)进行转发 用户的请求
####第一个里程碑-规划 分类
/upload 10.0.0.8:80 upload服务器
/static 10.0.0.7:80 static静态服务器
/ 10.0.0.9:80 默认
####第二个里程碑-创建澡堂子
upstream upload_pools {
server 10.0.0.8:80;
}
upstream static_pools {
server 10.0.0.7:80;
}
upstream default_pools {
server 10.0.0.9:80;
}
##第三个里程碑-什么时候去某一个澡堂子(条件)
location ====== 专门用来匹配判断 uri if ($uri ~ xxxx)
location /static/ {
proxy_passhttp://static_pools;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
#将符合upload的请求交给上传服务器池upload_pools,配置如下:
location /upload/ {
proxy_passhttp://upload_pools;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
#不符合上述规则的请求,默认全部交给动态服务器池default_pools,配置如下:
location / {
proxy_passhttp://default_pools;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
###第四个里程碑-配置lb负载均衡
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
log_format main '$remote_addr - $remote_user [$time_local]"$request" '
'$status $body_bytes_sent"$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
upstreamupload_pools {
server 10.0.0.8:80;
}
upstreamstatic_pools {
server 10.0.0.7:80;
}
upstreamdefault_pools {
server 10.0.0.9:80;
}
server {
listen 80;
server_name www.etiantian.org;
location/static/ {
proxy_pass http://static_pools;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For$remote_addr;
}
location /upload/ {
proxy_pass http://upload_pools;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For$remote_addr;
}
location / {
proxy_pass http://default_pools;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For$remote_addr;
}
access_log logs/access_www.log main;
}
}
###第五个里程碑-创建环境
www.etiantian.org/bingbing.html
www.etiantian.org/upload/bingbing.html
www.etiantian.org/static/bingbing.html
##web01
mkdir -p/application/nginx/html/www/upload
echo "web01 upload">/application/nginx/html/www/upload/bingbing.html
##web02
mkdir -p/application/nginx/html/www/static
echo "web02 static">/application/nginx/html/www/static/bingbing.html
##web03
echo "web03 default" >/application/nginx/html/www/bingbing.html
###第五个里程碑-进行测试
[root@lb01 conf]# curlwww.etiantian.org/bingbing.html
web03 default
[root@lb01 conf]# curlwww.etiantian.org/static/bingbing.html
web02 static
[root@lb01 conf]# curlwww.etiantian.org/upload/bingbing.html
web01 upload
#####nginx.conflb01 基于 用户的客户端浏览器
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream upload_pools {
server 10.0.0.8:80;
}
upstream static_pools {
server 10.0.0.7:80;
}
upstream default_pools {
server 10.0.0.9:80;
}
server {
listen 80;
server_name www.etiantian.org;
location / {
if ($http_user_agent ~*"MSIE")
{
proxy_pass http://static_pools;
}
if ($http_user_agent ~*"Chrome")
{
proxy_pass http://upload_pools;
}
proxy_pass http://default_pools;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For$remote_addr;
}
}
}
[root@lb01 conf]# curl10.0.0.5/bingbing.html
web03 default
[root@lb01 conf]# curl10.0.0.5/static/bingbing.html
<html>
<head><title>404 NotFound</title></head>
<bodybgcolor="white">
<center><h1>404 NotFound</h1></center>
<hr><center>nginx/1.10.2</center>
</body>
</html>
[root@lb01 conf]# curl10.0.0.5/upload/bingbing.html
<html>
<head><title>404 NotFound</title></head>
<body bgcolor="white">
<center><h1>404 NotFound</h1></center>
<hr><center>nginx/1.10.2</center>
</body>
</html>
[root@lb01 conf]# curl -A chrome10.0.0.5/upload/bingbing.html
web01 upload
[root@lb01 conf]# curl10.0.0.5/bingbing.html
web03 default
[root@lb01 conf]# curl -A msie10.0.0.5/static/bingbing.html
web02 static
[root@lb01 conf]# ####访问一个目录 nginx 默认找的文件是 index.html index.htm
[root@lb01 conf]# #####如果这些文件不存在 nginx报错 403
[root@lb01 conf]# curl -A chrome10.0.0.5/upload/oldboy.txt
<html>
<head><title>404 NotFound</title></head>
<bodybgcolor="white">
<center><h1>404 NotFound</h1></center>
<hr><center>nginx/1.10.2</center>
</body>
</html>
404错误
[root@lb01 conf]# ####1.10.0.0.5 访问我的反向代理 lb01
[root@lb01 conf]# ####2.10.0.0.5 默认访问第一个虚拟主机 server
[root@lb01 conf]# ####3.查看对应的条件 uri 目录
[root@lb01 conf]# # if ($http_user_agent ~*"MSIE")
[root@lb01 conf]# #
[root@lb01 conf]# # {
[root@lb01 conf]# # proxy_pass http://static_pools;
[root@lb01 conf]# # }
[root@lb01 conf]# # if ($http_user_agent ~*"Chrome")
[root@lb01 conf]# #
[root@lb01 conf]# # {
[root@lb01 conf]# # proxy_pass http://upload_pools;
[root@lb01 conf]# # }
[root@lb01 conf]# #proxy_pass http://default_pools;
[root@lb01 conf]# ####4.最后找到的是 默认的池塘 里面没有 upload 目录
[root@lb01 conf]# ####5. 没有这个目录 404 找不到
[root@lb01 conf]# curl 10.0.0.5/upload/
<html>
<head><title>404 NotFound</title></head>
<bodybgcolor="white">
<center><h1>404 NotFound</h1></center>
<hr><center>nginx/1.10.2</center>
</body>
</html>
403错误
[root@lb01 conf]# curl -A msie 10.0.0.5/static/
<html>
<head><title>403Forbidden</title></head>
<bodybgcolor="white">
<center><h1>403Forbidden</h1></center>
<hr><center>nginx/1.10.2</center>
</body>
</html>
[root@lb01 conf]# ####1.lb01
[root@lb01 conf]# ####2.匹配的是第一个虚拟主机 10.0.0.5 www.etiantian.org
[root@lb01 conf]# ####3.进入location
[root@lb01 conf]# # if ($http_user_agent ~*"MSIE")
[root@lb01 conf]# #
[root@lb01 conf]# # {
[root@lb01 conf]# # proxy_pass http://static_pools;
[root@lb01 conf]# # }
[root@lb01 conf]# # if ($http_user_agent ~*"Chrome")
[root@lb01 conf]# #
[root@lb01 conf]# # {
[root@lb01 conf]# # proxy_pass http://upload_pools;
[root@lb01 conf]# # }
[root@lb01 conf]# ####5.判断
[root@lb01 conf]# ####-A 装作是msie
[root@lb01 conf]# ####6.扔到了static_pools 10.0.0.7
[root@lb01 conf]# ####7.10.0.0.7 这个机器上面 有/static 目录
[root@lb01 conf]#####8.10.0.0.5/static/ =====10.0.0.5/static/index.html
[root@lb01 conf]# ####9.找首页文件 但是 首页文件不存在就显示403 默认去找index.html
[root@lb01 conf]#
[root@lb01 conf]# ####10.找不到就汇报403 错误 。
##1.浏览器缓存 ctrl+F5
##2.域名没有解析
##3.修改了配置文件,没重启 配置文件没生效
转载于:https://blog.51cto.com/dadonggg/1946509
相关文章:

中国IT潜在的巨大希望
这些天玩了好多软件,都是大公司的。联想的网盘,阿里巴巴的阿里旺旺和淘宝,百度的百度HI,谷歌的google talk,腾讯的拍拍还有腾讯下的一些东西,等等很多东西。你如果把他们定义成软件公司似乎不对,…
【怎样写代码】向现有类型“添加”方法 -- 扩展方法(四):在编译时绑定扩展方法的规则
如果喜欢这里的内容,你能够给我最大的帮助就是转发,告诉你的朋友,鼓励他们一起来学习。 If you like the content here, you can give me the greatest help is forwarding, tell your friends, encourage them to learn together.

linux下刻录iso,linux刻录iso
弹性云服务器 ECS弹性云服务器(Elastic Cloud Server)是一种可随时自助获取、可弹性伸缩的云服务器,帮助用户打造可靠、安全、灵活、高效的应用环境,确保服务持久稳定运行,提升运维效率三年低至5折,多种配置可选了解详情认证鉴权|…
【怎样写代码】实现对象的复用 -- 享元模式(一):问题案例
如果喜欢这里的内容,你能够给我最大的帮助就是转发,告诉你的朋友,鼓励他们一起来学习。 If you like the content here, you can give me the greatest help is forwarding, tell your friends, encourage them to learn together.

基于 Webpack 3 的 React 工程项目脚手架
基于 Webpack 3 的 React 工程项目脚手架从属于笔者的 Web 前端入门与工程实践,算来已经是笔者 React 技术栈脚手架的第四个迭代版本。更多关于 React 或者前端开发相关的资料链接可以参考React 学习与实践资料索引以及 Webpack 学习与资料索引,对于其中…

汽车加油c语言作业,算法作业—汽车加油问题
一辆汽车加满油后可以行驶N千米。旅途中有若干个加油站。指出若要使沿途的加油次数最少,设计一个有效的算法,指出应在那些加油站停靠加油。给出N,并以数组的形式给出加油站的个数及相邻距离,指出若要使沿途的加油次数最少…

5招全面扫描网站页面的质量
http://www.chinawebanalytics.cn/?p161转载于:https://www.cnblogs.com/zhwj184/archive/2010/01/06/3027522.html

Linux常用命令的简单实用
1.linux目录结构 /etc:(etcetera):系统配置文件存放的目录。不建议在此目录下存放可执行文件。重要的配置文件有,如上图。 /usr:(unix shared resourced) 应用程序存放目录,/usr/bin 存放应用程序,/usr/share 存放共享数据,/usr/l…
【怎样写代码】实现对象的复用 -- 享元模式(二):解决方案
如果喜欢这里的内容,你能够给我最大的帮助就是转发,告诉你的朋友,鼓励他们一起来学习。 If you like the content here, you can give me the greatest help is forwarding, tell your friends, encourage them to learn together.

串的堆分配存储c语言,数据结构c语言串的堆分配存储源程序
《数据结构c语言串的堆分配存储源程序》由会员分享,可在线阅读,更多相关《数据结构c语言串的堆分配存储源程序(7页珍藏版)》请在人人文库网上搜索。1、include#include#include#define OK 1#define ERROR 0#define OVERFLOW -2typedef int Status;typede…

c#网络编程初探
我们知道C#和C++的差异之一,就是他本身没有类库,所使用的类库是.Net框架中的类库--.Net FrameWork SDK。在.Net FrameWork SDK中为网络编程提供了二个名称空间:"System.Net"和"System.Net.S…

SharePoint 2016 工作流报错“没有适用于此应用程序的地址”
前言 最近为SharePoint 2016配置工作流,创建工作流的过程中遇到这样一个错误,记录分享下来,希望能够为有需要的人带来帮助。 错误截图 创建完毕工作流,发布的时候报错,保存没有问题。 错误信息 Microsoft.SharePoint.S…
【怎样写代码】实现对象的复用 -- 享元模式(三):享元模式
如果喜欢这里的内容,你能够给我最大的帮助就是转发,告诉你的朋友,鼓励他们一起来学习。 If you like the content here, you can give me the greatest help is forwarding, tell your friends, encourage them to learn together.

c语言写输入汉字输出区位码程序,2017年计算机应用基础检测试题
2017年计算机应用基础检测试题计算机科学是一门包含各种各样与计算和信息处理相关主题的系统学科,从抽象的算法分析、形式化语法等等。下面是小编整理的关于计算机应用基础检测试题及答案,希望大家认真阅读!一、单选题1.已知x101010B,对x求逻…

ASP.NET页生命周期概述
ASP.NET页生命周期的定义,有以下8个方面:页请求,开始,页初始化,页加载,验证,回发事件,呈现,卸载。 ASP.NET 页运行时,此页将经历一个生命周期,在生…

robotframework的学习笔记(十二)------DatabaseLibrary 库
1、安装DatabaseLibrary库 DatabaseLibrary 下载地址:https://pypi.python.org/pypi/robotframework-databaselibrary/然后进入存放目录:C:\robot\robotframework-databaselibrary-0.6>python setup.py install 或者如果安装过pip的话直接C:\Python27…
【怎样写代码】实现对象的复用 -- 享元模式(四):享元模式与字符串
如果喜欢这里的内容,你能够给我最大的帮助就是转发,告诉你的朋友,鼓励他们一起来学习。 If you like the content here, you can give me the greatest help is forwarding, tell your friends, encourage them to learn together.

c语言考试经典编程题目及答案,经典练习C语言编程的题目及答案整理
你想学好C语言吗?做好文档上的题目,你能掌握基本的C语言1.逆序输出正三位数#include int main(){int input,output 0;scanf("%d",&input);while(input ! 0){output output*10 input%10;input / 10;}printf("%d\n",output);return 0;}2.百…

2009年国内十强开源CMS排行榜[转]
近十年来,中国互联网的发展有目共睹,网民数量更是超越美国成为世界第一,在中国互联网的发展历程中,一直以来默默地为中国站长提供动力的CMS厂商作出的贡献尤其巨大,而与之成反比的是CMS厂商的生存状态依然令人担忧&…
【怎样写代码】偷窥高手 -- 反射技术(一):前期准备
如果喜欢这里的内容,你能够给我最大的帮助就是转发,告诉你的朋友,鼓励他们一起来学习。 If you like the content here, you can give me the greatest help is forwarding, tell your friends, encourage them to learn together.

MySQL RR隔离级别的更新冲突策略
对于事务的隔离级别,MySQL中默认是RR, Oracle中默认是RC,两个事务隔离级别存在着很大的差别,而换句话说,就算是RR的事务隔离级别级别,同是关系型数据库MySQL,SQLServer,postgreSQL也会有一些差别。所以隔离级别的部分还是值得花一…

c语言选择题库和解系,OC单个对象归档和解档关键类和方法名
// 文件归档(一)//需要参数(归档对象、归档路径)//参数设置NSArray *array[ "hello","world",{"name":"Maky"},45];NSString *path[NSHomeDirectory() stringByAppendingPathComponent:"Desktop/test/test.plist"];//归档过…

DIV布局SEO的影响
代码精简使用DIVCSS布局,页面代码精简,这一点相信对XHTML有所了解的都知道。代码精简所带来的直接好处有两点:一 是提高spider爬行效率,能在最短的时间内爬完整个页面,这样对收录质量有一定好处;二是由于能高效的爬行&…

Linux 基础学习
Linux简单命令转载于:https://blog.51cto.com/moriwendu/1947863
【怎样写代码】偷窥高手 -- 反射技术(二):窥视内部
如果喜欢这里的内容,你能够给我最大的帮助就是转发,告诉你的朋友,鼓励他们一起来学习。 If you like the content here, you can give me the greatest help is forwarding, tell your friends, encourage them to learn together.

怎样用c语言解一元一次方程,问一道算法题目(解一元一次方程的问题)
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼#include#includevoid fun(char *a,int left ,int right , int *b ,int *c) // int fun(字符数组 上界 下界 常数 系数){int f; // 符号位int sum ; //数字位int i; // 循环变量f1;sum0;for (ileft; i< right ; i){ if(a[i] -)…

shiro整合oauth
前言 如果oauth原理还不清楚的地方,其参考这里。 一、基本思路脑图 二、客户端shiro配置 shiro配置文件 <?xml version"1.0" encoding"UTF-8"?> <beans xmlns"http://www.springframework.org/schema/beans"xmlns:util&q…
2010年的退休畅想
有了确定的目标应该是终究可以实现的,比如新买的房子,每一次路过那个地方都要心里暗暗向往,闹市中还能这么安静的地方,托人也买不到的地方,以为注定与我无缘,金融危机让大家都平等了,于是拥有了…
【怎样写代码】偷窥高手 -- 反射技术(三):深入窥视字段
如果喜欢这里的内容,你能够给我最大的帮助就是转发,告诉你的朋友,鼓励他们一起来学习。 If you like the content here, you can give me the greatest help is forwarding, tell your friends, encourage them to learn together.

android studio 库项目管理,在Android Studio中将现有项目转换为库项目
在模块的applicationId文件中(如果使用模块,则不是根项目!),只需替换:apply plugin: com.android.application// or, if youre on an old versionapply plugin: android // note: this one is deprecated...具有:apply…