AWS Japan YouTube 公式チャンネルでライブ配信された 2022年4月26日の AWS Developer Live Show 「Infrastructure as Code 談議 2022」 の資料となります。 当日の配信はこちら からご確認いただけます。
https://youtu.be/ed35fEbpyIE
2018/10/5 に開催された Analytics Architecture Night - Tokyo の発表資料です
https://analyticsarchitecturenighttoky.splashthat.com/
AWS Japan YouTube 公式チャンネルでライブ配信された 2022年4月26日の AWS Developer Live Show 「Infrastructure as Code 談議 2022」 の資料となります。 当日の配信はこちら からご確認いただけます。
https://youtu.be/ed35fEbpyIE
2018/10/5 に開催された Analytics Architecture Night - Tokyo の発表資料です
https://analyticsarchitecturenighttoky.splashthat.com/
This document summarizes new features and improvements in MySQL 8.0. Key highlights include utf8mb4 becoming the default character set to support Unicode 9.0, performance improvements for utf8mb4 of up to 1800%, continued enhancements to JSON support including new functions, expanded GIS functionality including spatial reference system support, and new functions for working with UUIDs and bitwise operations. It also provides a brief history of MySQL and outlines performance improvements seen in benchmarks between MySQL versions.
This document summarizes benchmarks of MySQL multi-thread slave performance using different numbers of slave_parallel_workers threads on Oracle Cloud MySQL instances. It finds that using 16 threads provides the best performance, processing queries faster and keeping the slave less behind the master compared to lower thread counts. CPU usage is also lower with 16 threads even though more threads are used.
6. MySQL PostgreSQL
[mysql]> CREATE USER 'admin'@'192.168.56.0/255.255.255.0' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.01 sec)
root@localhost [mysql]> select user,host from mysql.user;
+------------------+----------------------------+
| user | host |
+------------------+----------------------------+
| application | % |
| admin | 192.168.56.0/255.255.255.0 |
| admin | 192.168.10.0/255.255.255.0 |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+----------------------------+
6 rows in set (0.00 sec)
[ec2-user@ec2 ~]$ mysql -h 192.168.56.10 -u application -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 79
Server version: 8.0.18 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
postgres=# CREATE ROLE admin LOGIN;
CREATE ROLE
postgres=# ALTER ROLE admin WITH PASSWORD 'password';
ALTER ROLE
postgres=# ALTER ROLE admin SUPERUSER;
ALTER ROLE
# cat /var/lib/pgsql/12/data/postgresql.conf | grep listen
listen_addresses = '*'
# cat /var/lib/pgsql/12/data/pg_hba.conf | grep admin
host all admin 192.168.56.0/24 md5
DESKTOP-A5QLPD0:~/$ psql -h 192.168.56.104 -U admin postgres
Password for user admin:
psql (10.10 (Ubuntu 10.10-0ubuntu0.18.04.1), server 12.0)
WARNING: psql major version 10, server major version 12.
Some psql features might not work.
Type "help" for help.
postgres=# du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
admin | Superuser | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
CREATE USER コマンドでアカウントを作成 (“ユーザー名”@”ホスト”)
接続許可はユーザとパスワードだけでなく、クライアントのホストを含む
ホストの指定はホスト名、IPアドレス、ワイルドカード、サブネットでの指定が可能
同一ユーザ名でも接続元ホストが異なる場合は別アカウントになる
ユーザーやグループでなくロールでアクセス管理を実施するようになっています。
pgsqlでは無く、shellから直接アカウントを作成したい場合は、postgresユーザー
に切り替えてから"createuser ロール名"で作成する事も可能です。
postgresql.confでListenするアドレス、pg_hba.confにて接続元を許可する設定を行います。
例: User and Remote Connection
7. ユーザ権限
MySQL (https://dev.mysql.com/doc/refman/5.6/ja/privileges-provided.html) PostgreSQL (https://www.postgresql.jp/document/11/html/sql-grant.html)
$mysql -u root -p -e "desc user" mysql | grep "_priv"
Select_priv enum('N','Y') NO N
Insert_priv enum('N','Y') NO N
Update_priv enum('N','Y') NO N
Delete_priv enum('N','Y') NO N
Create_priv enum('N','Y') NO N
Drop_priv enum('N','Y') NO N
Reload_priv enum('N','Y') NO N
Shutdown_priv enum('N','Y') NO N
Process_priv enum('N','Y') NO N
File_priv enum('N','Y') NO N
Grant_priv enum('N','Y') NO N
References_priv enum('N','Y') NO N
Index_priv enum('N','Y') NO N
Alter_priv enum('N','Y') NO N
Show_db_priv enum('N','Y') NO N
Super_priv enum('N','Y') NO N
Create_tmp_table_priv enum('N','Y') NO N
Lock_tables_priv enum('N','Y') NO N
Execute_priv enum('N','Y') NO N
Repl_slave_priv enum('N','Y') NO N
Repl_client_priv enum('N','Y') NO N
Create_view_priv enum('N','Y') NO N
Show_view_priv enum('N','Y') NO N
Create_routine_priv enum('N','Y') NO N
Alter_routine_priv enum('N','Y') NO N
Create_user_priv enum('N','Y') NO N
Event_priv enum('N','Y') NO N
Trigger_priv enum('N','Y') NO N
Create_tablespace_priv enum('N','Y') NO N
Create_role_priv enum('N','Y') NO N
Drop_role_priv enum('N','Y') NO N
postgres=# SELECT rolname FROM pg_roles;
rolname
---------------------------
pg_monitor
pg_read_all_settings
pg_read_all_stats
pg_stat_scan_tables
pg_read_server_files
pg_write_server_files
pg_execute_server_program
pg_signal_backend
postgres
postgres=# GRANT pg_signal_backend TO admin;
postgres=# GRANT pg_monitor TO admin;
postgres=# du
ロール一覧
ロール名 | 属性 | 所属グループ
----------+---------------------------------+--------------------------------
admin | スーパユーザ | {pg_monitor,pg_signal_backend}
postgres | スーパユーザ, ロール作成可 ... | {}
postgres=# select oid, * from pg_authid;
-[ RECORD 1 ]--+------------------------------------
oid | 3373
oid | 3373
rolname | pg_monitor
rolsuper | f
rolinherit | t
rolcreaterole | f
rolcreatedb | f
<SNIP>
8. 設定反映のタイミング
MySQL PostgreSQL
[mysql]> CREATE USER 'application'@'192.168.56.0/255.255.255.0'
IDENTIFIED BY 'password';
[mysql]> GRANT ALL PRIVILEGES ON `APP`.* TO `application`@`%`;
-bash-4.2$ /usr/pgsql-12/bin/pg_ctl reload
サーバにシグナルを送信しました
-bash-4.2$
CREATE USER, GRANT, ALTERコマンド実行と同時にメモリー内にキャッシュされた権限設定もFlash
されるので、アカウントへの設定は即時反映されます。
NOTE: ユーザーが直接テーブルのデータをINSERT、UPDATE、DELETE等で更新した場合は、
[mysql]> FLUSH PRIVILEGES;でマニュアルでメモリー内にキャッシュされた権限をFlushする
必要があります。
pg_hba.confファイルはPostgreSQL起動した時とPostgresのプロセスにSIGHUP
シグナルを送信したタイミングで読み込まれます。
10. MySQL Global Role
SUPER
– CHANGE MASTER, KILL, PURGE MASTER LOGS, SET GLOBAL
SHUTDOWN
RELOAD
PROCESS
– SHOW ENGINE INNODB STATUSの実行にも必要
FILE
ALL
WITH GRANT OPTION
https://dev.mysql.com/doc/refman/5.6/ja/grant.html#grant-global-privileges
https://dev.mysql.com/doc/workbench/en/wb-mysql-connections-navigator-management-users-and-
privileges.html#wb-users-and-privileges-admin-roles
グローバル管理者権限はデータベース権限とは異なり、特定のサーバー上のすべてのデータベースに適用されます。