FAQ
Thanh toán và tài khoản

Bạn có tính phí cho các trường hợp dừng lại?

Có, các phiên bản ở trạng thái dừng tiếp tục dự trữ tài nguyên hệ thống chuyên dụng (RAM, lưu trữ SSD, bí danh IP, CPU) và do đó phải chịu phí cho đến khi bạn phá hủy phiên bản. Nếu bạn không muốn tích lũy phí cho máy ảo nữa, vui lòng sử dụng nút DESTROY trong cổng thông tin khách hàng.

Firewall Consideration

Although configuring a firewall is always a good idea, by default, MongoDB only listens on port 27017 on localhost, so it will receive no external traffic.

Important: Upgrades

Because MongoDB is now part of the AUR, pacman will not automatically compile and upgrade it to new versions, when you upgrade your entire Arch system. You will need to manually re-compile a new version and install the new package. Before doing so, it is important to look at MongoDB's release notes, to see if there are any extra steps you need to take. It's a good idea to backup your database before upgrading, as well.

Require Authentication

By default, MongoDB allows anyone to connect to it without any type of authentication, which is obviously a security risk.

Create a root database user:

$ mongo
> use admin
> db.createUser(
... {
... user: "root",
... pwd: "YOUR-NEW-PASSWORD",
... roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
... }
... )
> exit

Edit /etc/mongodb.conf, and if using package mongodb add:

security:
  authorization: "enabled"

If using package mongodb-bin add:

auth = true

Restart MongoDB:

# systemctl restart mongodb

Now, although you can still connect to MongoDB without authentication, it will not perform anything without it:

$ mongodb
> db.getUsers()
... Error: command usersInfo requires authentication :

Connect to MongoDB as root:

$ mongodb -u root

Alternatively, connect to MongoDB, then authenticate within it:

$ mongodb
> use admin
> db.auth("root", "<YOUR-DATABASE-ROOT-PASSWORD>")

Test Connection

Connect to MongoDB:

$ mongo

To quit:

> exit

Tôi đã liên kết thẻ tín dụng của mình nhưng tôi thấy một khoản phí nhỏ trong thẻ của mình! Đưa cái gì?

Chúng tôi chưa tính phí thẻ của bạn. Những gì bạn đã quan sát là một ủy quyền tạm thời để xác nhận thẻ được cung cấp. Giữ sẽ tự động hết hạn dựa trên chính sách của ngân hàng, thường là trong vòng một vài ngày.

Unclean Shutdown

If MongoDB does not cleanly shutdown, and does not automatically recover using its journal on the next boot, you may need to run the following:

sudo -u mongodb mongod --repair --dbpath /var/lib/mongodb/

Depending on the size of your database and indexes used, this process can range from seconds to hours.

Tuân thủ

Prerequisites

  • A Vultr server running up to date Arch Linux (see this article.)
  • A running webserver, either Apache or Nginx
  • Sudo access:
    • Commands required to be ran as root are prefixed by #. The recommended way to run commands as root is to, as a regular user, prefix each of them with sudo
  • Have a text editor installed, and be familiar with it, such as vi, vim, nano, emacs or a similar editor

Install Python 3.7 On Your Webserver

On Apache

Unfortunately, it is not supported to run both versions of Apache modules (for Python 2.x and 3.x) at the same time on the same Arch system, but this is rarely a problem.

To use Python 3.x:

# pacman -S mod_wsgi

Enable the Apache mod_wsgi module by editing /etc/httpd/conf/httpd.conf, and at the end of the list of LoadModule commands, add the following:

LoadModule wsgi_module modules/mod_wsgi.so

On Nginx

To use Python 3.x:

# pacman -S uwsgi-plugin-python

Test Python

Within the appropriate directory, create test.py with the following contents:

#-*- coding: utf-8 -*-
def wsgi_app(environment, start_response):
    import sys
    output = sys.version.encode('utf8')
    status = '200 OK'
    headers = [('Content-type', 'text/plain'),
               ('Content-Length', str(len(output)))]
    start_response(status, headers)
    yield output

application = wsgi_app

On Apache

Add to the end of /etc/httpd/conf/httpd.conf, or if you are running multiple hosts, edit the appropriate configuration file, and add in the appropriate <VirtualHost> block:

WSGIScriptAlias /wsgi_app /srv/http/test.py

Restart Apache:

# systemctl restart httpd

In a web browser, visit http://YOUR-SERVER-WEB-ADDRESS-OR-IP/wsgi_app, and you will see a test page with the python and GCC versions.

Delete the test.py test file you just created, and the WSGIScriptAlias in your Apache configuration.

Restart Apache:

# systemctl restart httpd

On Nginx

Create the file /etc/uwsgi/wsgi_app.ini with the following contents:

[uwsgi]
socket = /run/uwsgi/wsgi_app.sock
uid = http
gid = http
plugins = python
chdir = /usr/share/nginx/html/
wsgi-file=test.py
callable = application

Start uWSGI serving wsqi_app:

# systemctl start uwsgi@wsgi_app

Allow Nginx to use uWSGI by editing /etc/nginx/nginx.conf, and for every server block you want to test, add the following. Alternatively, if you are using virtual hosts, edit each host's configuration file:

location ~ \wsgi_app {
    root /usr/share/nginx/html/;
    include uwsgi_params;
    uwsgi_pass unix:/run/uwsgi/wsgi_app.sock;
}

Restart Nginx:

# systemctl restart nginx

In a web browser, visit http://YOUR-SERVER-WEB-ADDRESS-OR-IP/wsgi_app, and you will see a test page with the python and GCC versions.

Delete the test.py file you just created, and the location block you just added to /etc/nginx/nginx.conf for wsgi_app.

Restart Nginx:

# systemctl restart nginx

Stop uWSGI serving wsgi_app:

# systemctl stop uwsgi@wsgi_app

Delete the /etc/uwsgi/wsgi_app.ini and test.py test files you just created.

Kỹ thuật

Prerequisites

  • A Vultr server running up to date Arch Linux (see this article.)
  • Sudo access:
    • Commands required to be ran as root are prefixed by #, and ones that can be ran as a regular user by $. The recommended way to run commands as root is to, as a regular user, prefix each of them with sudo

You can choose to install either MariaDB or MySQL, outlined in the following two sections.

Install MariaDB 10.3 Database

Install MariaDB:

# pacman -S mariadb

If you run the Btrfs filesystem, you should consider disabling copy-on-write for the database directory for performance reasons:

# chattr +C /var/lib/mysql/

Configure MariaDB:

# mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Start MariaDB, and make it start after every boot:

# systemctl enable --now mariadb

Complete recommended security measures. At the beginning, press ENTER for the current root database password, set a new root password, and press ENTER to answer yes on all further prompts.

# mysql_secure_installation
VN | EN
Hotline: 0931 823 889