Quantcast
Channel: Hortonworks » All Replies
Viewing all articles
Browse latest Browse all 3435

Reply To: Ambari Server After Changing Host Names and IP

$
0
0

This appears to work in postgresql for the sandbox. Simply update the columns in the listed tables at the bottom of this post, restart, and you should be good to go. Not supported, but it works…


-bash-4.1$ whoami
postgres
-bash-4.1$ export CLASSPATH=.:~/postgresql-9.3-1102.jdbc41.jar
-bash-4.1$ cat searchtabs.java
import java.sql.*;

public class searchtabs {
public static void main(String[] args) {
try {
Class.forName("org.postgresql.Driver");
Connection con = DriverManager.getConnection("jdbc:postgresql:ambari","steve","welcome");
Statement st = con.createStatement();
DatabaseMetaData md = con.getMetaData();
ResultSet rs = md.getTables("ambari", "ambari", "%", null);
while (rs.next()) {
ResultSet rsc = md.getColumns("ambari","ambari",rs.getString(3),null);
int i = 0;
while (rsc.next()) {
if (rsc.getString("TYPE_NAME").equals("character varying")
|| rsc.getString("TYPE_NAME").equals("text")
|| rsc.getString("TYPE_NAME").equals("varchar")) {
try {
Statement stm = con.createStatement();
ResultSet rst = stm.executeQuery("select " + rsc.getString("COLUMN_NAME") +
" from ambari." + rs.getString(3) +
" where " + rsc.getString("COLUMN_NAME") + " like '%hortonworks.com%'");
while (rst.next()) {
System.out.printf("%-40s %s\n", rs.getString(3), rsc.getString("COLUMN_NAME"));
}
}
catch (Exception e1) {
//e1.printStackTrace();
}
}
}
}
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}
-bash-4.1$ java searchtabs | sort -u
blueprint_configuration config_data
clusterconfig config_data
clusterhostmapping host_name
hostcomponentdesiredstate host_name
hostcomponentstate host_name
host_role_command event
host_role_command host_name
hosts host_name
hosts public_host_name
hoststate host_name
metainfo metainfo_value
viewinstanceproperty value
-bash-4.1$


Viewing all articles
Browse latest Browse all 3435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>