Я пишу hive-UDTF для разрешения IP-адреса путем загрузки файла .dat в HDFS, но встречаю ошибку:
java.io.FileNotFoundException: hdfs:/THE_IP_ADDRESS:9000/tmp/ip_20170204.dat (Permission denied)
Но на самом деле и каталог dfs /tmp, и файл .data имеют полный доступ: 777
, и я не могу изменить конфигурацию, чтобы отключить разрешение dfs.
Строка в моем UDTF для чтения файла:
IP.load("hdfs://THE_IP_ADDRESS:9000/tmp/ip_20170204.dat");
и статический метод .load()
:
public static void load(String filename) {
ipFile = new File(filename);
load();
if (enableFileWatch) {
watch();
}
}
private static void load() {
lastModifyTime = ipFile.lastModified();
FileInputStream fin = null;
lock.lock();
try {
dataBuffer = ByteBuffer.allocate(Long.valueOf(ipFile.length()).intValue());
fin = new FileInputStream(ipFile);
int readBytesLength;
byte[] chunk = new byte[4096];
while (fin.available() > 0) {
readBytesLength = fin.read(chunk);
dataBuffer.put(chunk, 0, readBytesLength);
}
dataBuffer.position(0);
int indexLength = dataBuffer.getInt();
byte[] indexBytes = new byte[indexLength];
dataBuffer.get(indexBytes, 0, indexLength - 4);
indexBuffer = ByteBuffer.wrap(indexBytes);
indexBuffer.order(ByteOrder.LITTLE_ENDIAN);
offset = indexLength;
int loop = 0;
while (loop++ < 256) {
index[loop - 1] = indexBuffer.getInt();
}
indexBuffer.order(ByteOrder.BIG_ENDIAN);
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (fin != null) {
fin.close();
}
} catch (IOException e){
e.printStackTrace();
}
lock.unlock();
}
}
hive
толстого клиента? У вас включена аутентификация Kerberos или нет? У вас есть подключаемый модуль для авторизации, например Ranger или Sentry? - person Samson Scharfrichter   schedule 05.05.2017