Wednesday, August 29, 2018

BTS V performance

https://www.twiceweb.net/board/view/ent_bangtan/30

BTS V his home life with his family



he looks so happy! 😊

https://www.twiceweb.net/board/view/ent_bangtan/22

How to set up MySQL max connections

This shows current max connections for mysql.
mysql> show variables like 'max_connections';

This shows current used connections for now.
mysql> show status like 'Max_used_connections';

To check how many connections were aborted. If you see aborted connection, you might need to increase max connection settings.
mysql> show status like 'Aborted%';

To change max connections:
mysql> set global max_connections=300;

If you want permanent settings:
# vi /etc/my.cnf
[mysqld]
max_connections = 300

You need to restart to make the change of /etc/my.cnf to be effective.
service mysqld restart

and check it again:
mysql> show variables like 'max_connections';



https://www.twiceweb.net/board/view/software/12


How to check HTTPS active connections on linux

netstat -an | grep :443 | grep ESTABLISHED | wc -l





https://www.twiceweb.net/board/view/software/11

[MySQL] reducing memory usage on cloud server

in /etc/mysql/my.cnf

[mysqld]

performance_schema=OFF


how to use crontab [linux]

* listing current crontab:
crontab -l

* editing crontab:
crontab -e

* example (once every 1st day of month):
0 0 1 * * shell_command_here

* special strings:
string         meaning
------         -------
@reboot        Run once, at startup.
@yearly        Run once a year, "0 0 1 1 *".
@annually      (same as @yearly)
@monthly       Run once a month, "0 0 1 * *".
@weekly        Run once a week, "0 0 * * 0".
@daily         Run once a day, "0 0 * * *".
@midnight      (same as @daily)
@hourly        Run once an hour, "0 * * * *".
 



https://www.twiceweb.net/board/view/software/8

Vultr Tokyo sysbench performance benchmark result

vultr performance test result (Tokyo region)


1 vCPU@2.4GHz
1GB RAM
25GB SSD
1TB traffic
$5/month

sysbench CPU test : 298 events/s

sysbench memory : 2850MB/s

sysbench file I/O :
    read: 21.77MB/s
    write: 14.51MB/s

sysbench mysql
    read-only : 455 transactions/s, 7289 queries/s
    read-write : 149 transactions/s, 2988 queries/s
    write-only : 280.89 transactions/s, 1685 queries/s


how to redirect HTTP to HTTPS on nginx

sudo vi /etc/nginx/sites-available/SITEDOMAIN

server {
  listen 80 default_server;
  listen [::]:80 default_server;
  server_name _;
  return 301 https://$host$request_uri;
}

The first listen statement is for HTTP port of IPv4.
The second listen statement if for HTTP port of IPv6.
You can redirect from specific domain name as following:
server_name example.com www.example.com




https://www.twiceweb.net/board/view/computer/22

how to check the file count in a folder (Ubuntu,CentOS,Linux)




find . -type f | wc -l




https://www.twiceweb.net/board/view/computer/21

how to check disk space usage or free disk space on Ubuntu

$ df -h
the result:
Filesystem      Size  Used Avail Use% Mounted on
udev            464M     0  464M   0% /dev
tmpfs            99M  664K   98M   1% /run
/dev/vda1        25G  4.9G   19G  21% /

 



https://www.twiceweb.net/board/view/computer/20

how to check ubuntu free memory

$ free -m
you see like the following:
              total        used        free      shared  buff/cache   available
Mem:            985         661         191           1         132         185
Swap:             0           0           0


If you want memory usage and CPU consumption of each process:
$ top
or
$ htop
htop highlights information with color texts.


How to change timezone on Ubuntu 18.x

Check current timezone

$ timedatectl

Show available timezones

$ timedatectl list-timezone

Change timezone

$ sudo timedatectl set-timezone Asia/Seoul


how to use ubuntu firewall (ufw) 우분투 방화벽 ufw사용하는 법

Warning: If you enable ufw, then the default rule might block everything including your remote terminal connection.

기본 규칙 확인하기

check the default rule

$ cat /etc/default/ufw


ufw상태확인

check ufw status :

$ sudo ufw status verbose


기본정책 설정하기 : 기본적으로 들어오는 패킷은 모두 막고, 서버에서 나가는 패킷은 모두 허용합니다.

set up default policies

$ sudo ufw default deny incoming
$ sudo ufw default allow outgoing


SSH연결 허용하기 (필수. 이 규칙이 없으면 원격터미널연결이 불가능해집니다.)

allow SSH connections (you need this rule to connect to your server via remote terminal program)

$ sudo ufw allow ssh
or allow port 22 (default ssh port = 22)
$ sudo ufw allow 22


UFW켜기

enable UFW

$ sudo ufw enable


UFW상태 확인

check ufw status

$ sudo ufw status verbose


HTTP허용하기

allow HTTP (if you need)

$ sudo ufw allow http
or
$ sudo ufw allow 80


HTTPS허용하기

allow HTTPS (if you need)

$ sudo ufw allow https
or
$ sudo ufw allow 443


포트범위 허용하기

allow specific port ranges (ex. 3000~3003 TCP port)

$ sudo ufw allow 3000:3003/tcp


IP주소 허용하기

allow specific IP address

$ sudo ufw allow from 11.12.13.14
IP & port allow rule:
$ sudo ufw allow from 11.12.13.14 to any port 22


서브넷 허용하기

allow subnets (ex. 11.12.13.1 ~ 11.12.13.254)

$ sudo ufw allow from 11.12.13.0/24


연결 막기

deny connections

$ sudo ufw deny ftp
or deny port 21
$ sudo ufw deny 21
or deny ip address
$ sudo ufw deny from 11.12.13.14


방화벽규칙번호 확인

list firewall rule number

$ sudo ufw status numbered


번호로 방화벽규칙 삭제

delete ufw rule by rule number (ex. delete ufw rule number 2)

$ sudo ufw delete 2


내용으로 방화벽규칙 삭제

delete ufw rule by actual rule

$ sudo ufw delete allow http


UFW방화벽 끄기

disable UFW firewall

$ sudo ufw disable


Vultr Tokyo sysbench performance benchmark result

vultr performance test result (Tokyo region)


1 vCPU@2.4GHz
1GB RAM
25GB SSD
1TB traffic
$5/month

sysbench CPU test : 298 events/s

sysbench memory : 2850MB/s

sysbench file I/O :
    read: 21.77MB/s
    write: 14.51MB/s

sysbench mysql
    read-only : 455 transactions/s, 7289 queries/s
    read-write : 149 transactions/s, 2988 queries/s
    write-only : 280.89 transactions/s, 1685 queries/s