很多使用 EMQ X 消息服务器的童鞋,会发现随着业务量的增长会考虑到 EMQ X 节点的扩容,多节点之后,如果节点前没有挂载代理,就需要在客户端指定连接哪台 EMQ X 节点,如果其中一台节点升级,还需要在客户端重新做设置,但如果在集群节点挂载反向代理,就可以通过反向代理将连接分配到另外节点上,从而避免在客户端的更改和重新部署。So,今天 EMQ君就聊聊 Nginx 反向代理的事吧!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REBAR3_URL=https://s3.amazonaws.com/rebar3/rebar3 | |
ifeq ($(wildcard rebar3),rebar3) | |
REBAR3 = $(CURDIR)/rebar3 | |
endif | |
REBAR3 ?= $(shell test -e `which rebar3` 2>/dev/null && which rebar3 || echo "./rebar3") | |
ifeq ($(REBAR3),) | |
REBAR3 = $(CURDIR)/rebar3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
binmstime() -> | |
%% The time is EMQ server time | |
{Year, Mon, Day} = date(), | |
{Hour, Min, Sec} = time(), | |
{_, _, MicroSecs} = erlang:timestamp(), | |
list_to_binary( | |
lists:flatten( | |
io_lib:format("~2..0w~2..0w~2..0w~2..0w~2..0w~2..0w~3..0w", [Year,Mon,Day,Hour,Min,Sec,trunc(MicroSecs/1000)]))). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo route -n add -net 132.246.0.0 -netmask 255.255.0.0 192.168.7.1 |
- HTTP 形式:
git clone https://github.com/owner/git.git
- SSH 形式:
git clone git@github.com:owner/git.git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# %CopyrightBegin% | |
# | |
# Copyright Ericsson AB 1996-2012. All Rights Reserved. | |
# | |
# The contents of this file are subject to the Erlang Public License, | |
# Version 1.1, (the "License"); you may not use this file except in | |
# compliance with the License. You should have received a copy of the | |
# Erlang Public License along with this software. If not, it can be |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vi /etc/environment | |
add these lines... | |
LANG=en_US.utf-8 | |
LC_ALL=en_US.utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Generate a lot of clients for emqx 5.0 | |
-module(emqx_clients_gen). | |
-compile(export_all). | |
-compile(nowarn_export_all). | |
-define(LOG(Fmt, Args), io:format(Fmt, Args)). | |
%%-------------------------------------------------------------------- | |
%% APIs |
The shadowsocks protocol is very similar to SOCKS5 but encrypted and simpler.
Below is the structure of a shadowsocks request (sent from client-side), which is identical for both TCP and UDP connections before encrypted (or after decrypted).
+--------------+---------------------+------------------+----------+
| Address Type | Destination Address | Destination Port | Data |
+--------------+---------------------+------------------+----------+
| 1 | Variable | 2 | Variable |
+--------------+---------------------+------------------+----------+