问题
Hi I'm very new to Hadoop.
I have installed Microsoft HDInsight to my local system. Now I want to connect to hive and HBase but for HIVE connection I have to specify Connection string, port, username, password.
But I'm not able to figure out how I will get this value. I have tried with localhost and 8085 as a port but this doesn't work. I also done it by giving localhost IP and my system IP too.
Please help with this and let me know how i should proceed for HBase connectivity
回答1:
Your best bet is probably to use Microsoft's Hive SDK (also available on nuget as Microsoft.Hadoop.Hive)
There is a great sample on how to connect and run a Linq-to-Hive query at http://hadoopsdk.codeplex.com/wikipage?title=Simple%20Linq%20To%20Hive%20Query&referringTitle=LINQ%20to%20Hive
This used the WebHcat API to submit your query to Hive, and will work against an HDInsights cluster in the Azure cloud (hence the need to provide a storage key to get the results back again).
If you're only interested in using the local copy you can adapt the example to exclude the storage account credentials.
var db = new HiveConnection(
webHCatUri: new Uri("http://localhost:50111"),
userName: (string) "hadoop", password: (string) null);
var result = db.ExecuteHiveQuery("select * from w3c");
result.Wait();
works against a base install of HDInsight Preview.
来源:https://stackoverflow.com/questions/18103612/how-to-connect-hive-to-asp-net-project