1. event_scheduler 설정 확인

 

MariaDB [mysql]> show variables like'%event_scheduler%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | OFF   |
+-----------------+-------+
1 row in set (0.001 sec)

 

 

2. event_scheduler 를 ON 으로 설정

 

MariaDB [mysql]> set global event_scheduler = ON;
ERROR 1408 (HY000): Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.

 

에러가 난다.

 

 

3. Mariadb 서버를 빠져나와  mysql_upgrade 를 실행

mysql_upgrade 파일은 /usr/bin 에 있다.

[root@localhost my.cnf.d]# whereis mysql
mysql: /usr/bin/mysql /usr/lib64/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
[root@localhost my.cnf.d]# cd /usr/bin
[root@localhost bin]# pwd
/usr/bin
[root@localhost bin]# ls mysql* -ls
 4308 -rwxr-xr-x. 1 root root  4409824 Aug 10  2022 mysql
  112 -rwxr-xr-x. 1 root root   111950 Aug 10  2022 mysqlaccess
 3828 -rwxr-xr-x. 1 root root  3917696 Aug 10  2022 mysqladmin
 4076 -rwxr-xr-x. 1 root root  4171992 Aug 10  2022 mysqlbinlog
 3820 -rwxr-xr-x. 1 root root  3910760 Aug 10  2022 mysqlcheck
    8 -rwxr-xr-x. 1 root root     4217 Aug 10  2022 mysql_convert_table_format
   28 -rwxr-xr-x. 1 root root    27326 Aug 10  2022 mysqld_multi
   32 -rwxr-xr-x. 1 root root    30778 Aug 10  2022 mysqld_safe
 3464 -rwxr-xr-x. 1 root root  3543896 Aug 10  2022 mysqld_safe_helper
 3920 -rwxr-xr-x. 1 root root  4010816 Aug 10  2022 mysqldump
   12 -rwxr-xr-x. 1 root root     8242 Aug 10  2022 mysqldumpslow
20876 -rwxr-xr-x. 1 root root 21373048 Aug 10  2022 mysql_embedded
    4 -rwxr-xr-x. 1 root root     3290 Aug 10  2022 mysql_find_rows
    4 -rwxr-xr-x. 1 root root     1250 Aug 10  2022 mysql_fix_extensions
   36 -rwxr-xr-x. 1 root root    34963 Aug 10  2022 mysqlhotcopy
 3816 -rwxr-xr-x. 1 root root  3905592 Aug 10  2022 mysqlimport
   20 -rwxr-xr-x. 1 root root    20092 Aug 10  2022 mysql_install_db
 3504 -rwxr-xr-x. 1 root root  3587144 Aug 10  2022 mysql_plugin
   16 -rwxr-xr-x. 1 root root    12527 Aug 10  2022 mysql_secure_installation
   20 -rwxr-xr-x. 1 root root    17542 Aug 10  2022 mysql_setpermission
 3812 -rwxr-xr-x. 1 root root  3899944 Aug 10  2022 mysqlshow
 3832 -rwxr-xr-x. 1 root root  3923520 Aug 10  2022 mysqlslap
 3500 -rwxr-xr-x. 1 root root  3582424 Aug 10  2022 mysql_tzinfo_to_sql
 3596 -rwxr-xr-x. 1 root root  3678784 Aug 10  2022 mysql_upgrade
 3492 -rwxr-xr-x. 1 root root  3573856 Aug 10  2022 mysql_waitpid

 

 

4. mysql_upgrade 를 수행해 본다.

[root@localhost bin]# ./mysql_upgrade 
This installation of MariaDB is already upgraded to 10.11.8-MariaDB.
There is no need to run mysql_upgrade again for 10.11.8-MariaDB.
You can use --force if you still want to run mysql_upgrade

 

이미 업그레이드가 되어 있어서 할 필요가 없다 하므로 강제로 다시 시도한다.

 

[root@localhost bin]# ./mysql_upgrade -f
Phase 1/8: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.global_priv                                  OK
mysql.gtid_slave_pos                               OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.index_stats                                  OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.roles_mapping                                OK
mysql.servers                                      OK
mysql.table_stats                                  OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.transaction_registry                         OK
Phase 2/8: Installing used storage engines... Skipped
Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views

...

중략

...

performance_schema
sys
sys.sys_config                                     OK
test
Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK

 

 

5. my.cnf 파일에도 추가한다.

 

[root@localhost bin]# vi /etc/my.cnf.d/server.cnf

 

[mysqld]

 

event_scheduler = on

 

 

 

6. Mariadb 서버를 재시작한다.

 

[root@localhost bin]# systemctl restart mariadb

 

 

 

7. Mariadb 서버에 접속하여 event_scheduler 설정상태를 확인해 본다.

 

MariaDB [mysql]> show variables like '%event_scheduler%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | OFF   |
+-----------------+-------+
1 row in set (0.001 sec)

MariaDB [mysql]>

 

 

event_scheduler 를 ON 으로 세팅한다.

MariaDB [mysql]> set global event_scheduler = ON;
Query OK, 0 rows affected (0.000 sec)

MariaDB [mysql]> show variables like '%event_scheduler%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | ON    |
+-----------------+-------+
1 row in set (0.002 sec)

MariaDB [mysql]>

 

 

 

 

 

 

 

 

 

블로그 이미지

엘로드넷

,

 

osm2pgsql --append 가 속도가 느리므로 osm2pgsql --create 를 사용하기 위해 pbf파일을 묶어준다.

 

1. osmium-tool 설치

                    
renderaccount@ellord-Precision-T5600:/var/lib/postgresql$ sudo apt install osmium-tool
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다       
상태 정보를 읽는 중입니다... 완료
다음 새 패키지를 설치할 것입니다:
  osmium-tool
0개 업그레이드, 1개 새로 설치, 0개 제거 및 65개 업그레이드 안 함.
749 k바이트 아카이브를 받아야 합니다.
이 작업 후 2,461 k바이트의 디스크 공간을 더 사용하게 됩니다.
받기:1 http://kr.archive.ubuntu.com/ubuntu focal/universe amd64 osmium-tool amd64 1.11.1-1build2 [749 kB]
내려받기 749 k바이트, 소요시간 2초 (338 k바이트/초)
Selecting previously unselected package osmium-tool.
(데이터베이스 읽는중 ...현재 220379개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack .../osmium-tool_1.11.1-1build2_amd64.deb ...
Unpacking osmium-tool (1.11.1-1build2) ...
osmium-tool (1.11.1-1build2) 설정하는 중입니다 ...
Processing triggers for man-db (2.9.1-1) ...
renderaccount@ellord-Precision-T5600:/var/lib/postgresql$

 

 

2. pdf merge

 

osmuim cat asia.pbf africa.pbf -o merged.osm

cat 대신에  merge 를 사용해도 됨.

 

 

3. osm2pgsql 를 실행한다.

 

 

 

블로그 이미지

엘로드넷

,

줌 레벨별로 미리 렌더링 하기

 

 

$ render_list  --all -num-threads=1 --socket=/var/run/renderd/renderd.sock --tile-dir=/home2/mod_tile --map=ajt --min-zoom=10 --max-zoom=11 

 

1. --all : render all tiles

2. -num-threads : rendering에 사용될 cpu core 수 (default 1)

3. --tile-dir : 지도 이미지 저장 경로

4. --map :  zoom별 지도 이미지 저장 폴더

5. --min-zoom : 최소레벨( default 0)

6. --max-zoom : 최대레벨(default 20)

 

ajt : 맵데이터가 저장된 폴더명 (--tile-dir 옵션이 주어지지 않으면 디폴트는 /var/lib/mod_tile/ajt)

 

 

 

위 명령어는 다음과 같이 해도 된다.

 

$ render_list  -a -n 1 -s /var/run/renderd/renderd.sock -t /home2/mod_tile -m ajt -z 10 Z 11 

 

renderaccount@48efa0ebd424:/var/lib/mod_tile$ render_list -v --all -n 1 --socket=/var/run/renderd/renderd.sock --min-zoom=10 --max-zoom=11 --map=ajt
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
Rendering client
Starting 1 rendering threads
Rendering all tiles from zoom 10 to zoom 11
Rendering all tiles for zoom 10 from (0, 0) to (1023, 1023)

 

 

renderd 로그 보기

 

아래와 같은 로그를 확인할 수 있다.

 

 

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/472) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(480), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 480-487, new metatile
renderd[58384]: Rendering projected coordinates 10 72 480 -> -17219733.732094|939258.203569 -16906647.664237|1252344.271425 to a 8 x 8 tile
renderd[58384]: DEBUG: DONE TILE ajt 10 72-79 480-487 in 0.369 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/ajt/10/0/0/1/78/128.meta

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/480) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(488), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 488-495, new metatile
renderd[58384]: Rendering projected coordinates 10 72 488 -> -17219733.732094|626172.135713 -16906647.664237|939258.203569 to a 8 x 8 tile
renderd[58384]: DEBUG: DONE TILE ajt 10 72-79 488-495 in 0.369 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/ajt/10/0/0/1/78/136.meta

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/488) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(496), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 496-503, new metatile
renderd[58384]: Rendering projected coordinates 10 72 496 -> -17219733.732094|313086.067856 -16906647.664237|626172.135713 to a 8 x 8 tile
renderd[58384]: DEBUG: DONE TILE ajt 10 72-79 496-503 in 0.369 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/ajt/10/0/0/1/79/128.meta

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/496) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(504), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 504-511, new metatile
renderd[58384]: Rendering projected coordinates 10 72 504 -> -17219733.732094|0.000000 -16906647.664237|313086.067856 to a 8 x 8 tile
renderd[58384]: DEBUG: DONE TILE ajt 10 72-79 504-511 in 0.373 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/ajt/10/0/0/1/79/136.meta

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/504) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(512), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 512-519, new metatile
renderd[58384]: Rendering projected coordinates 10 72 512 -> -17219733.732094|-313086.067856 -16906647.664237|0.000000 to a 8 x 8 tile
renderd[58384]: DEBUG: DONE TILE ajt 10 72-79 512-519 in 0.374 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/ajt/10/0/0/2/64/128.meta

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/512) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(520), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 520-527, new metatile
renderd[58384]: Rendering projected coordinates 10 72 520 -> -17219733.732094|-626172.135713 -16906647.664237|-313086.067856 to a 8 x 8 tile
renderd[58384]: DEBUG: DONE TILE ajt 10 72-79 520-527 in 0.368 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/ajt/10/0/0/2/64/136.meta

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/520) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(528), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 528-535, new metatile
renderd[58384]: Rendering projected coordinates 10 72 528 -> -17219733.732094|-939258.203569 -16906647.664237|-626172.135713 to a 8 x 8 tile
renderd[58384]: DEBUG: DONE TILE ajt 10 72-79 528-535 in 0.379 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/ajt/10/0/0/2/65/128.meta

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/528) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(536), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 536-543, new metatile
renderd[58384]: Rendering projected coordinates 10 72 536 -> -17219733.732094|-1252344.271425 -16906647.664237|-939258.203569 to a 8 x 8 tile
renderd[58384]: DEBUG: DONE TILE ajt 10 72-79 536-543 in 0.377 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/ajt/10/0/0/2/65/136.meta

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/536) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(544), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 544-551, new metatile
renderd[58384]: Rendering projected coordinates 10 72 544 -> -17219733.732094|-1565430.339281 -16906647.664237|-1252344.271425 to a 8 x 8 tile
renderd[58384]: DEBUG: DONE TILE ajt 10 72-79 544-551 in 0.378 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/ajt/10/0/0/2/66/128.meta

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/544) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(552), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 552-559, new metatile
renderd[58384]: Rendering projected coordinates 10 72 552 -> -17219733.732094|-1878516.407137 -16906647.664237|-1565430.339281 to a 8 x 8 tile
renderd[58384]: DEBUG: DONE TILE ajt 10 72-79 552-559 in 0.386 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/ajt/10/0/0/2/66/136.meta

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/552) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(560), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 560-567, new metatile
renderd[58384]: Rendering projected coordinates 10 72 560 -> -17219733.732094|-2191602.474994 -16906647.664237|-1878516.407137 to a 8 x 8 tile
renderd[58384]: DEBUG: DONE TILE ajt 10 72-79 560-567 in 0.378 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/ajt/10/0/0/2/67/128.meta

renderd[58384]: DEBUG: Sending render cmd(3 ajt 10/72/560) with protocol version 2 to fd 11
renderd[58384]: DEBUG: Got incoming request with protocol version 2
renderd[58384]: DEBUG: Got command RenderBulk fd(11) xml(ajt), z(10), x(72), y(568), mime(image/png), options()
renderd[58384]: DEBUG: START TILE ajt 10 72-79 568-575, new metatile
renderd[58384]: Rendering projected coordinates 10 72 568 -> -17219733.732094|-2504688.542850 -16906647.664237|-2191602.474994 to a 8 x 8 tile

 

 

 

렌더링된 맵데이터 용량 확인

 

아래와 같이 점점 증가하고 있음을 확인할 수 있다.

root@48efa0ebd424:/var/lib/mod_tile# pwd
/var/lib/mod_tile
root@48efa0ebd424:/var/lib/mod_tile# du -sh ajt
412M	ajt
root@48efa0ebd424:/var/lib/mod_tile# du -sh ajt
412M	ajt
root@48efa0ebd424:/var/lib/mod_tile# du -sh ajt
413M	ajt
root@48efa0ebd424:/var/lib/mod_tile# du -sh ajt
414M	ajt
root@48efa0ebd424:/var/lib/mod_tile#

 

블로그 이미지

엘로드넷

,