๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’ปTech/๐ŸฌMySQL

MySQL, MariaDB ํ•œ๊ธ€ ๊นจ์ง ํ˜„์ƒ ํ•ด๊ฒฐ(Hive Metastore)

by _viper_ 2023. 8. 21.
๋ฐ˜์‘ํ˜•

Hive์—์„œ desc๋กœ ํ…Œ์ด๋ธ” ์กฐํšŒ ์‹œ ํ•œ๊ธ€ comment๊ฐ€ ๊นจ์ง€๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋Š”๋ฐ, 

metastore DB ํ•œ๊ธ€ ์„ค์ •์ด ์•ˆ ๋ผ์„œ ๊ทธ๋ ‡์Šต๋‹ˆ๋‹ค.

์•„๋ž˜ ์กฐ์น˜ ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

 

MySQL

1. my.cnf ์ˆ˜์ •

  • my.cnf ํŒŒ์ผ ์—ด์–ด์„œ ์•„๋ž˜๋‚ด์šฉ์—์„œ ์—†๋Š”๊ฒƒ๋“ค์„ ์ถ”๊ฐ€ํ•ด ์ฃผ์„ธ์š”.
[root@localhost]$ vi /etc/my.cnf
----------------------------------------------------------
[client]
character-sets-dir = utf8

[mysqld]
init_connect=SET collation_connection = utf8_general_ci
init_connect=SET NAMES utf8
character-set-server = utf8
collation-server = utf8_general_ci

[mysqldump]
default-character-set = utf8

[mysql]
default-character-set = utf8
----------------------------------------------------------

2. mysql ์„œ๋น„์Šค ์žฌ๊ธฐ๋™

[root@localhost]$ service mysqld restart   

 

 

MariaDB

1. server.cnf์ˆ˜์ •

[root@localhost]$ vi /etc/my.cnf.d/server.cnf
----------------------------------------------
[server]
character-set-server=utf8
----------------------------------------------

2. mariadb ์„œ๋น„์Šค ์žฌ๊ธฐ๋™

[root@localhost]$ systemctl restart mariadb

 

 

๐Ÿ”Ž ์ฐธ๊ณ 

โ—พ ๊ธฐ์กด metastore์˜ ํ…Œ์ด๋ธ”๋“ค Character-Set ๋ณ€๊ฒฝ

  • ๊ธฐ์กด์˜ ์ƒ์„ฑ๋œ Database๋‚˜ Table๋“ค์˜ Character-Set์ด ๋ณ€๊ฒฝ๋˜๋Š” ๊ฒƒ์€ ์•„๋‹ˆ๊ธฐ ๋•Œ๋ฌธ์—,
    hive metastore db ํ•œ๊ธ€ ๊ด€๋ จ ํ…Œ์ด๋ธ”๋“ค์„ ์ง์ ‘ ๋ณ€๊ฒฝํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค. 
##table coulmn character-set ๋ณ€๊ฒฝ
alter table COLUMNS_V2 modify COMMENT mediumtext character set utf8 collate utf8_general_ci;
alter table TABLE_PARAMS modify PARAM_VALUE mediumtext character set utf8 collate utf8_general_ci;
alter table SERDE_PARAMS modify PARAM_VALUE mediumtext character set utf8 collate utf8_general_ci;
alter table SD_PARAMS modify PARAM_VALUE mediumtext character set utf8 collate utf8_general_ci;
alter table PARTITION_PARAMS modify PARAM_VALUE varchar(4000) character set utf8 collate utf8_general_ci;
alter table PARTITION_KEYS modify PKEY_COMMENT varchar(4000) character set utf8 collate utf8_general_ci;
alter table INDEX_PARAMS modify PARAM_VALUE varchar(4000) character set utf8 collate utf8_general_ci;
alter table DATABASE_PARAMS modify PARAM_VALUE varchar(4000) character set utf8 collate utf8_general_ci;
alter table DBS modify `DESC` varchar(4000) character set utf8 collate utf8_general_ci;
alter table TBLS modify VIEW_EXPANDED_TEXT mediumtext character set utf8 collate utf8_general_ci;
alter table TBLS modify VIEW_ORIGINAL_TEXT mediumtext character set utf8 collate utf8_general_ci;

## table ํ™•์ธ
show full columns from COLUMNS_V2;
show full columns from TABLE_PARAMS;
show full columns from SERDE_PARAMS;
show full columns from SD_PARAMS;
show full columns from PARTITION_PARAMS;
show full columns from PARTITION_KEYS;
show full columns from INDEX_PARAMS;
show full columns from DATABASE_PARAMS;
show full columns from DBS;

 

โ—พ character ๊ด€๋ จ ๋ช…๋ น์–ด

##๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค character set ํ™•์ธ
show create database DB๋ช…; 

##๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ character set ๋ณ€๊ฒฝ
alter database DB๋ช… default character set = utf8;

##ํ…Œ์ด๋ธ” character set ํ™•์ธ
show create table ํ…Œ์ด๋ธ”๋ช…;

##ํ…Œ์ด๋ธ”์˜ character set ๋ณ€๊ฒฝ
alter table ํ…Œ์ด๋ธ”๋ช… default character set = utf8;