티스토리 뷰
[hdfs] webhdfs에 요청을 보냈을 때 Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error 오류 처리
hs_seo 2021. 7. 8. 20:38HA 구성 된 HDFS에 webhdfs 로 요청을 보냈을 때 스탠바이(standby) 상태의 노드가 이런 응답을 보낼 때가 있습니다.
HA 구성된 HDFS는 두 개의 HDFS가 각 active, standby 상태로 운영됩니다. 그런데 standby 상태의 노드에 조회 요청을 하면 오류가 발생합니다.
# 상태 확인
$ hdfs haadmin -getAllServiceState
host1:8020 active
host2:8020 standby
# 데이터 조회 오류
$ curl --negotiate -u: -sS -L -X GET -k "https://host2:50470/webhdfs/v1/?op=GETFILESTATUS&user.name=hdfs"
{"RemoteException":{"exception":"StandbyException","javaClassName":"org.apache.hadoop.ipc.StandbyException","message":"Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error"}}
이 문제의 원인은 HDFS 상에서 standby 상태의 네임노드는 명령을 처리하지 않도록 하기 때문입니다. Git 에서 확인해 보면 알 수 있습니다. 설정을 통해 이 부분을 체크하지 않도록 할 수도 있지만 소스코드에 테스트 모드일 때만 이 부분을 해제하라고 되어 있습니다.
// 원본 | |
// https://github.com/apache/hadoop/blob/03cfc852791c14fad39db4e5b14104a276c08e59/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/HAUtil.java#L224 | |
public class HAUtil { | |
... | |
/** | |
* This is used only by tests at the moment. | |
* @return true if the NN should allow read operations while in standby mode. | |
*/ | |
public static boolean shouldAllowStandbyReads(Configuration conf) { | |
return conf.getBoolean(DFS_HA_ALLOW_STALE_READ_KEY, | |
DFS_HA_ALLOW_STALE_READ_DEFAULT); | |
} | |
... | |
} |
<configuration> | |
<property> | |
<name>dfs.ha.allow.stale.reads</name> | |
<value>true</value> | |
</property> | |
</configuration> |
네임노드는 액티브 상태의 노드는 현재 디렉토리 구조를 정확하게 알고 있지만, 스탠바이 상태의 노드는 네임노드와 데이터 노드의 리포트를 받기 전에는 정확한 상태를 알 수 없기 때문에 그렇게 되어 있다고 생각됩니다. 그래서 설정이 있음에도 hdfs-default.xml 에도 빠져 있습니다. 하둡 3.4 부터는 hdfs-default.xml 에도 추가 되었다고 합니다.
https://issues.apache.org/jira/browse/HDFS-15356
[HDFS-15356] Unify configuration `dfs.ha.allow.stale.reads` to DFSConfigKeys - ASF JIRA
Unify to Define configuration key `dfs.ha.allow.stale.reads` in DFSConfigKeys and give the default value and notice at hdfs-default.xml.
issues.apache.org
결론
dfs.ha.allow.stale.reads 설정을 통해 문제를 해결할 수 있지만, 현재 상태가 최신이 아닐 수도 있다는 것을 감안해야 한다.
'빅데이터 > hdfs' 카테고리의 다른 글
[hdfs] HDFS 메타 데이터 백업 및 복구 (0) | 2022.02.22 |
---|---|
[hdfs] 네임노드의 fsimage 파일 구조 (0) | 2022.02.22 |
[hdfs] HDFS WebHDFS REST API 사용법 (0) | 2020.01.09 |
[hadoop-hdfs] HDFS 포맷 하는 방법 (0) | 2019.12.26 |
[hadoop-hdfs] HDFS Archival Storage, SSD & Memory (0) | 2019.08.07 |
- Total
- Today
- Yesterday
- java
- 다이나믹
- mysql
- 파이썬
- hbase
- airflow
- S3
- ubuntu
- SQL
- HDFS
- 하이브
- emr
- 하둡
- Hadoop
- 정올
- yarn
- build
- 백준
- Linux
- Tez
- nodejs
- 알고리즘
- Python
- oozie
- HIVE
- AWS
- 오류
- bash
- SPARK
- error
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |