Created 12-28-2015 06:45 PM
Ambari 2.1.2 - HDP 2.3.2
Startup of the Hive metastore fails because schema tool can't validate the the hive.VERSION table. According to this, http://docs.hortonworks.com/HDPDocuments/Ambari-2.... Ambari is supposed to create the schema automatically with an HDP stack of 2.2 (I'm assuming later versions as well)
Kris
Created 12-28-2015 06:54 PM
Hive schema is created only if the hive schema has not already been created and is created before starting Hive Metastore.
create_schema_cmd = format("export HIVE_CONF_DIR={hive_server_conf_dir} ; " "{hive_bin}/schematool -initSchema " "-dbType {hive_metastore_db_type} " "-userName {hive_metastore_user_name} " "-passWord {hive_metastore_user_passwd!p}")
check_schema_created_cmd = as_user(format("export HIVE_CONF_DIR={hive_server_conf_dir} ; " "{hive_bin}/schematool -info " "-dbType {hive_metastore_db_type} " "-userName {hive_metastore_user_name} " "-passWord {hive_metastore_user_passwd!p}"), params.hive_user)
Execute(create_schema_cmd, not_if = check_schema_created_cmd, user = params.hive_user )
Created 12-28-2015 06:54 PM
Hive schema is created only if the hive schema has not already been created and is created before starting Hive Metastore.
create_schema_cmd = format("export HIVE_CONF_DIR={hive_server_conf_dir} ; " "{hive_bin}/schematool -initSchema " "-dbType {hive_metastore_db_type} " "-userName {hive_metastore_user_name} " "-passWord {hive_metastore_user_passwd!p}")
check_schema_created_cmd = as_user(format("export HIVE_CONF_DIR={hive_server_conf_dir} ; " "{hive_bin}/schematool -info " "-dbType {hive_metastore_db_type} " "-userName {hive_metastore_user_name} " "-passWord {hive_metastore_user_passwd!p}"), params.hive_user)
Execute(create_schema_cmd, not_if = check_schema_created_cmd, user = params.hive_user )
Created 12-28-2015 07:47 PM
I now see where the agent is calling initSchema... had missed it before.
It fails when run from Ambari but succeeded when run from the cli. I'll accept an answer and drive on.
Created 12-28-2015 06:55 PM
@kkaneI just installed a couple of clusters last week and Ambari created the schema in MySQL Database I specified. So, there are two possible scenarios.
1.If this is fresh cluster install, I think there is issue with permission on database, please check the same.
2. If this is upgraded cluster, you should upgrade Hive metastore as well.
Created 12-28-2015 06:57 PM
Today, Ambari calls "hive.cmd --service schematool -info ...", and if that fails, it assumes that the schema isn't created, so it then calls, "hive.cmd --service schematool -initSchema ..." This works for HDP 2.0.6 and higher.
See https://github.com/apache/ambari/blob/trunk/ambari... Several internal Jiras have tracked this issue, BUG-14330, BUG-39736, BUG-17404