1. 程式人生 > >Shell讀取hdfs配置檔案內容

Shell讀取hdfs配置檔案內容

hdfs上檔案內容

[[email protected] test]# hdfs dfs -cat /test/jdbc.properties
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.10.1:3306/
jdbc.username=root
jdbc.password=123456

讀取內容指令碼

#!/bin/bash
user=`hdfs dfs -cat /test/jdbc.properties |sed '/^jdbc.username=/!d;s/.*=//'`
echo $user