Nginx反向代理、镜像缓存加速及负载均衡的配置
none
Nginx已经具备Squid所拥有的Web缓存加速功能、清除指定URL缓存的功能。而在性能上,Nginx对多核CPU的利用,胜过Squid不少。另外,在反向代理、负载均衡、健康检查、后端服务器故障转移、Rewrite重写、易用性上,Nginx也比Squid强大得多。
...none
Nginx已经具备Squid所拥有的Web缓存加速功能、清除指定URL缓存的功能。而在性能上,Nginx对多核CPU的利用,胜过Squid不少。另外,在反向代理、负载均衡、健康检查、后端服务器故障转移、Rewrite重写、易用性上,Nginx也比Squid强大得多。
...none
location / {
root html;
index index.html index.htm;
client_max_body_size 1000m;
}
“client_max_body_size”设置一下上传的最大上限,然后重启nginx即可。
none
首先安装erlang语言环境
yum install erlang -y
rabbitMQ下载地址:直达安装方法:
rpm -ivh --force --nodeps rabbitmq-server-3.6.0-1.noarch.rpm
或者
yum localinstall rabbitmq-server-3.6.0-1.noarch.rpm -y
/etc/init.d/rabbitmq-server start
rabbitmq-plugins enable rabbitmq_management
chmod 777 /var/lib/rabbitmq/.erlang.cookie
scp /var/lib/rabbitmq/.erlang.cookie Go02:/var/lib/rabbitmq/.erlang.cookie
chmod 400 /var/lib/rabbitmq/.erlang.cookie
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl join_cluster [--ram] rabbit@Go01 //此处的Go01为主节点的hostname,需要在/etc/hosts中指定
rabbitmqctl start_app
rabbitmqctl stop_app
rabbitmqctl forget_cluster_node rabbit@rabbit1
rabbitmqctl stop_app
rabbitmqctl change_cluster_node_type ram
rabbitmqctl start_app
rabbitmqctl add_user admin admin
添加权限:
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
删除测试用户:
rabbitmqctl delete_user guest
赋予其administrator角色:
rabbitmqctl set_user_tags admin administrator
//防止服务端异常中断恢复后镜像队列不能恢复的问题
vim /etc/rabbitmq/rabbitmq.conf
[
{rabbit,[{tcp_listeners,[5672]},
{cluster_partition_handling, autoheal}]}
].
#不要忘记最后面的那个点号哦!
touch /etc/rabbitmq/rabbitmq-env.conf#输入
RABBITMQ_NODENAME=FZTEC-240088 节点名称 RABBITMQ_NODE_IP_ADDRESS=127.0.0.1 监听IP
RABBITMQ_NODE_PORT=5672 监听端口 RABBITMQ_LOG_BASE=/data/rabbitmq/log 日志目录
RABBITMQ_PLUGINS_DIR=/data/rabbitmq/plugins 插件目录
RABBITMQ_MNESIA_BASE=/data/rabbitmq/mnesia 后端存储目录
none、management、policymaker、monitoring、administrator
...none
RabbitMQ中,所有生产者提交的消息都由Exchange来接受,然后Exchange按照特定的策略转发到Queue进行存储
RabbitMQ提供了四种Exchange:fanout,direct,topic,header
...none
rabbitmq.config文件时rabbitmq的配置文件,他遵守Erlang配置文件定义。
rabbitmq.config文件位置:
...今天遇到一个rabbitmq集群同时断电,当机器全部启动的时候发现rabbitmq无法正常启动,然后发现如下日志。
=INFO REPORT==== 25-Apr-2018::11:11:07 ===
Starting RabbitMQ 3.5.3 on Erlang R16B03-1
Copyright (C) 2007-2014 GoPivotal, Inc.
Licensed under the MPL. See http://www.rabbitmq.com/
=INFO REPORT==== 25-Apr-2018::11:11:07 ===
node : rabbit@WIN-ACC2J7AGNM9
home dir : C:\Users\Administrator
config file(s) : e:/RabbitMQ Data/rabbitmq.config (not found)
cookie hash : kR4NuIdBr2n8/4Qt9uIgqQ==
log : E:/RabbitMQ Data/log/rabbit@WIN-ACC2J7AGNM9.log
sasl log : E:/RabbitMQ Data/log/rabbit@WIN-ACC2J7AGNM9-sasl.log
database dir : e:/RabbitMQ Data/db/rabbit@WIN-ACC2J7AGNM9-mnesia
=WARNING REPORT==== 25-Apr-2018::11:11:07 ===
Kernel poll (epoll, kqueue, etc) is disabled. Throughput and CPU utilization may worsen.
=INFO REPORT==== 25-Apr-2018::11:11:08 ===
Memory limit set to 13095MB of 32738MB total.
=INFO REPORT==== 25-Apr-2018::11:11:08 ===
Disk free limit set to 50MB
=INFO REPORT==== 25-Apr-2018::11:11:08 ===
Limiting to approx 8092 file handles (7280 sockets)
=INFO REPORT==== 25-Apr-2018::11:11:38 ===
Timeout contacting cluster nodes: ['rabbit@WIN-2W6NDAIZBIA'].
BACKGROUND
==========
This cluster node was shut down while other nodes were still running.
To avoid losing data, you should start the other nodes first, then
start this one. To force this node to start, first invoke
"rabbitmqctl force_boot". If you do so, any changes made on other
cluster nodes after this one was shut down may be lost.
DIAGNOSTICS
===========
attempted to contact: ['rabbit@WIN-2W6NDAIZBIA']
rabbit@WIN-2W6NDAIZBIA:
* connected to epmd (port 4369) on WIN-2W6NDAIZBIA
* epmd reports: node 'rabbit' not running at all
no other nodes on WIN-2W6NDAIZBIA
* suggestion: start the node
current node details:
- node name: 'rabbit@WIN-ACC2J7AGNM9'
- home dir: C:\Users\Administrator
- cookie hash: kR4NuIdBr2n8/4Qt9uIgqQ==
关键的地方在于中间的这段说明:
...vim /etc/rabbitmq/rabbitmq-env.conf
vim /etc/rabbitmq/rabbitmq-env.conf
# I am a complete /etc/rabbitmq/rabbitmq-env.conf file.
# Comment lines start with a hash character.
# This is a /bin/sh script file - use ordinary envt var syntax
MNESIA_BASE=/data/rabbitmq/mnesia
LOG_BASE=/data/logs/rabbitmq
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak #备份
sudo vim /etc/apt/sources.list #修改
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
sudo vim /etc/apt/sources.list #修改
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
sudo apt-get update #更新列表
一个非常好用的vim配置文件
Vim是一个类似于Vi的著名的功能强大、高度可定制的文本编辑器,在Vi的基础上改进和增加了很多特性。VIM是自由软件。
...vim常见操作
![vi-vim-cheat-sheet-sch.png](/static/uploads/BJ8I8E9U0M/img/vi-vim-cheat-
sheet-sch_SyLsV8yY4.png)
1、左移h、右移l、下移j、上移k
2、向下翻页ctrl + f,向上翻页ctrl + b
3、向下翻半页ctrl + d,向上翻半页ctrl + u
...