/* * There is high probability that the rack id generated here will * not conflict with those of other data node cluster. * Not perfect but mostly unique rack ids are good enough */ private static string GetUniqueRackPrefix() { string ip = "unknownIP"; try { ip = DNS.GetDefaultIP("default"); } catch (UnknownHostException) { System.Console.Out.WriteLine("Could not find ip address of \"default\" inteface." ); } int rand = DFSUtil.GetSecureRandom().Next(int.MaxValue); return("/Rack-" + rand + "-" + ip + "-" + Time.Now()); }