Install OpenResty Edge
1. Architecture
OpenResty Edge contains three main roles (Node, Admin, Log-Server), and the architecture of the three is as follows:
- Node: A specific gateway.
- Admin: Used to manage Node.
- Log-Server: Used to store and view logs.
2. Cluster
For clusters with a scale of about 10 nodes, we recommend:
- Admin and Admin DB are deployed on the same machine.
- Log Server and Log-Server DB are deployed on the same machine.
If the scale becomes larger in the future, they can be deployed separately.
In addition, for data security, we recommend to start a slave of the other DB on each machine:
- A slave of the Log Server DB on the Admin DB machine.
- A slave of Admin DB on the Log Server DB machine.
Edge Admin and Edge Log Server: It is recommended to use a machine with 4 cores, 16G memory and 200G SSD hard disk. Edge Node: Depends on the volume of business. It is roughly 1 cpu core with 2g memory, such as 8c16g, 200G hard disk.
3. Installation
Notice
The following documents/information need to be prepared before installation.init_admin_db_VERSION.sh
init_log_server_db_VERSION.sh
openresty-edge-config-VERSION.rpm
oropenresty-edge-config-VERSION.deb
3.1 Set the firewall whitelist
We will need to access the following public network addresses. If your network has a firewall, you need to add proper rules to white list them.
openresty.com 443
openresty.org 443
pkg.openresty.com 443
api.openresty.com 443
3.2 Database installation and initialization
listening port 5432.
-
Copy
openresty-edge-config
to the current directory -
Download the installation script:
curl -O https://openresty.com/client/oredge/install-edge-postgresql.sh
If you get a message like the following:
curl: command not found
It is possible that
curl
is not installed on the system or that the system shell program does not contain a search path forcurl
.You can use absolute paths to retry.
/usr/bin/curl -O https://openresty.com/client/oredge/install-edge-postgresql.sh
Your system’s path may be different, contact your webmaster or use a command such as
which bash
to check the path to correct the situation. -
Install and initialize Admin DB:
# Install sudo /bin/bash install-edge-postgresql.sh # Initialize # Replace VERSION with the actual version number /bin/bash init_admin_db_VERSION.sh
-
Install and initialize Log Server DB: If you are building a production environment, we recommend installing Admin DB and Log Server DB on separate machines.
# Install sudo /bin/bash install-edge-postgresql.sh # Initialize # Replace VERSION with the actual version number /bin/bash init_log_server_db_VERSION.sh
3.3 Admin Web Installation
Listening ports 443 and 12345. (443 provides management background, 12345 is used to communicate with Node)
-
Copy
openresty-edge-config
to the current directory -
Download the installation script:
curl -O https://openresty.com/client/oredge/install-edge-admin.sh
-
Execute the installation script:
sudo /bin/bash install-edge-admin.sh
-
Put the certificate and private key here (you can skip it if you don’t have one)
/usr/local/oredge-admin/conf/ssl/ssl.crt /usr/local/oredge-admin/conf/ssl/ssl.key
-
Modify configuration: (If Database, Admin, Log-Server use the same machine, you can use the default configuration)
1.Database address
2.Log-Server address
# This file will not be automatically overwritten by subsequent upgrades, please be careful not to leave a space at the beginning of the line sudo vim /usr/local/oredge-admin/conf/config.ini
-
Reload Admin
sudo systemctl reload oredge-admin
Now Admin should be able to be used normally (we only opened HTTPS): https://your-admin.com/
-
login username:
admin
-
Get login password: (please change the password after successful login)
grep -rs "password :" init_admin_db_VERSION.sh
3.4 double admin-web (Optional)
If you want to improve the availability of admin-web, deploying two admin-web service as master-master may be a good choice.
-
Follow step 3 above to install another admin-web.
-
Modify the configuration
# This file will not be automatically overwritten by subsequent upgrades, so be careful not to leave spaces at the beginning of lines sudo vim /usr/local/oredge-admin/conf/config.ini
You need to modify the
host
field under theclone_admin
section, use the another admin-web service address as the configure value.After the changes, reload the admin-web service. The two admin-web services are in master-master mode now.
3.5 Log-Server Installation
Listening ports 8089 and 12346. (8089 is used to communicate, 12346 is used to communicate with Node)
-
Copy
openresty-edge-config
to the current directory -
Download the installation script:
curl -O https://openresty.com/client/oredge/install-edge-log-server.sh
-
Execute the installation script:
sudo /bin/bash install-edge-log-server.sh
-
Modify configuration: (If Database, Admin, Log-Server use the same machine, you can use the default configuration)
1.Database address
2.Admin address
# This file will not be automatically overwritten by subsequent upgrades, please be careful not to leave a space at the beginning of the line sudo vim /usr/local/oredge-log-server/conf/config.ini
-
Reload Log Server
sudo systemctl reload oredge-log-server
-
At this time, you should be able to get the logs under [Control Panel] - [Logs] in Admin.
3.6. Edge Node Installation
-
Copy
openresty-edge-config
to the current directory -
Download the installation script:
curl -O https://openresty.com/client/oredge/install-edge-node.sh
-
Execute the installation script:
sudo /bin/bash install-edge-node.sh
-
Modify configuration:
1.Admin address
2.Log-Server address
# This file will not be automatically overwritten by subsequent upgrades, please be careful not to leave a space at the beginning of the line sudo vim /usr/local/oredge-node/conf/config.ini
You can configure the host2
field under the admin
section if you configured the master-master mode admin-web service.
Node will use host
and host2
randomly (regardless of configuration order) and will switch to the other admin-web service automatically when one admin-web is down.
-
Reload Node:
sudo systemctl reload oredge-node
So far, the full set of OpenResty Edge has been built.
4. Start the OpenResty Edge service
We provide online documents, and related blog posts and corresponding video tutorials.
If you have any questions, please contact us.