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

[Hive] metastore ์Šคํ‚ค๋งˆ ๋ฒ„์ „ ์—…๊ทธ๋ ˆ์ด๋“œ

by _viper_ 2020. 6. 2.
๋ฐ˜์‘ํ˜•

์‚ฌ์šฉ ์ค‘์ด๋˜ hive ๋ฒ„์ „์„ ์˜ฌ๋ ธ์„ ๋•Œ metastore ์Šคํ‚ค๋งˆ๊ฐ€ ๋ณ€๊ฒฝ๋œ ๊ฒฝ์šฐ ์Šคํ‚ค๋งˆ๋„ ์—…๊ทธ๋ ˆ์ด๋“œ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

์—…๊ทธ๋ ˆ์ด๋“œํ•˜์ง€ ์•Š์œผ๋ฉด hive ์„œ๋น„์Šค ์‹คํ–‰ํ•  ๋•Œ ์•„๋ž˜์™€ ๊ฐ™์ด ํ•ด๋‹น ์ปฌ๋Ÿผ์„ ์ฐพ์„ ์ˆ˜ ์—†๋‹ค๋Š” ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

java.sql.BatchUpdateException: Unknown column 'DB_MANAGED_LOCATION_URI' in 'field list'

 

๐Ÿ’น ์—…๊ทธ๋ ˆ์ด๋“œ ๋ฐฉ๋ฒ•

hive์—์„œ ์ง€์›ํ•˜๋Š” schemaTool์„ ์‚ฌ์šฉํ•˜์—ฌ ์—…๊ทธ๋ ˆ์ด๋“œ ์ง„ํ–‰ํ•ด ์ค๋‹ˆ๋‹ค.

 

โ—พ ๋ฒ„์ „ ํ™•์ธ ๋ช…๋ น์–ด

hive --service schemaTool -url jdbc:mysql://[HOSTNAME]:3306/metastore -userName hive --passWord hive -dbType mysql -info

 

โ—พ ์—…๊ทธ๋ ˆ์ด๋“œ ๋ช…๋ น์–ด

hive --service schemaTool -url jdbc:mysql://[HOSTNAME]:3306/metastore -userName hive --passWord hive -dbType mysql -upgradeSchema

 

๐Ÿ”Ž ์ฐธ๊ณ 

์ €๊ฐ™์€ ๊ฒฝ์šฐ๋Š” url, user, password๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์ง€ ์•Š์•„์„œ ์•„๋ž˜์™€ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์—ˆ์Šต๋‹ˆ๋‹ค.

DBname๊ณผ user ํ™•์ธ ํ›„ ์ง์ ‘ ๋ช…์‹œํ•ด ์คฌ์Šต๋‹ˆ๋‹ค.

Metastore connection URL:        jdbc:derby:;databaseName=metastore_db;create=true
Metastore connection Driver :    org.apache.derby.jdbc.EmbeddedDriver
Metastore connection User:       APP
Failed to get schema version, Cause:Table/View 'VERSION' does not exist.
Use --verbose for detailed stacktrace.
*** schemaTool failed ***