- 背景描述
cdh版本5.16.2,sentry+hive+hue,启用notebook
由于在集成sentry后,hue上的账号需要分离,原有用户hdfs的notebook需要迁移到其他的新用户。
- 登陆老用户的账户
可以直接使用hue界面的export功能,一次性导出所有notebook,如图
- 登陆新账户的用户,导入上一步下载的json文件,如图
一切看起来很顺利,但是在新用户打开导入的notebook时,会报错:Document does not exist or you don't have the permission to access it.
不啰嗦,直接上解决方法:
1.打开该notebook后,直接点击报错,这时会在documents界面存在两个同名的notebook,内容一致,根据时间删除老的notebook即可
2.从根本上分析这个问题,实际为json文件如下,
[
{
"pk": 408840,
"model": "desktop.document2",
"fields": {
"search": "",
"uuid": "7687b328-e9b7-4c53-a4fe-9c5edee4b1ed",
"extra": "",
"type": "notebook",
"description": "",
"is_history": false,
"parent_directory": [
"0d1cdf8f-38b0-4713-86c7-291992768e14",
1,
false
],
"is_managed": false,
"last_modified": "2020-01-09T09:49:44",
"version": 1,
"owner": [
"ewt"
],
"dependencies": [],
"data": "{\"forceHistoryInitialHeight\": false, \"loadingHistory\": true, \"schedulerViewModel\": null, \"retryModalCancel\": null, \"schedulerViewModelIsLoaded\": false, \"historyTotalPages\": 1, \"unloaded\": false, \"pubSubUrl\": null, \"retryModalConfirm\": null, \"isPresentationMode\": false, \"uuid\": \"7687b328-e9b7-4c53-a4fe-9c5edee4b1ed\", \"onSuccessUrl\": null, \"id\": 408840, \"historyFilterVisible\": false, \"historyInitialHeight\": 0, \"snippets\": [], \"selectedSnippet\": \"notebook\", \"type\": \"notebook\", \"historyFilter\": \"\", \"description\": \"\", \"sessions\": [], \"updateHistoryFailed\": false, \"executingAllIndex\": 0, \"presentationSnippets\": {}, \"isBatchable\": false, \"isHistory\": false, \"isPresentationModeDefault\": false, \"initialType\": \"notebook\", \"coordinatorUuid\": null, \"name\": \"zhaobaozhu\", \"isManaged\": false, \"isExecutingAll\": false, \"isHidingCode\": false, \"loadingScheduler\": false, \"viewSchedulerId\": \"\", \"isSaved\": true, \"historyCurrentPage\": 1, \"creatingSessionLocks\": [], \"directoryUuid\": \"\", \"parentSavedQueryUuid\": null, \"dependentsCoordinator\": []}",
"is_trashed": false,
"name": "zhaobaozhu"
}
}
]
在import时会将json文件中data对应的内容插入到hue元数据的desktop_document2表中,数据大概如图:
该元数据表的id为自增,在插入该表时,data中的内容不会改变,因此导致了data中的id值和元数据表的id值不相同,data中的id仍然为老用户notebook所属的id,因此会出现权限不足的错误,因此也可以将import后新用户报错的notebook export修改data中的id与pk相同后,再import 到新用户的notebook,手动更新data中的id
到此该问题解决。
来源:CSDN
作者:星期天的亚索
链接:https://blog.csdn.net/zbz1006572352/article/details/103904848