๋ฐ์ํ
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;