hostname

Need to identify local machine somehow in java

戏子无情 提交于 2019-12-01 11:33:31
问题 I'm trying to find out the name of the local machine (or some other way of uniquely identifying a particular machine) that an application is running on. I've been using this: String hostname = java.net.InetAddress.getLocalHost().getHostName(); which works fine, but I just happened to notice in the profiler that it's taking quite a bit of time to execute that so I was wondering if there was something functionally similar that ran more quickly. Doesn't have to be host name, could be anything as

How to get host name from this kind of URL?

北慕城南 提交于 2019-12-01 10:49:14
I want to get host name from and inner URL. how to take that. eg :- this is the inner url format .. http://hostname.com/folder/folder2/test.php?id=243432432424243 How to take the http://hostname.com from the above URL using php? Use parse_url . You want the 'scheme' and 'host' elements of the output array (and maybe 'port' , 'user' and 'password' as well - you can use http_build_url to stick these bits together if you want). A concise way would be: $url = 'http://hostname.com/folder/folder2/test.php?id=243432432424243'; echo parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST);

Configuring FQDN for GCE instance on startup

蹲街弑〆低调 提交于 2019-12-01 09:18:21
I am trying to start a google compute engine (GCE) instance with a pre-configured FQDN. We are intending to run an application that is licensed based on the contents of /etc/hosts. I am starting the instances using the Google Cloud SDK utility - gcloud. I have tried setting the "hostname" key using the metadata option like so: gcloud compute instances create mynode (standard opts) --metadata hostname=mynode.example.com Whenever I log into the developer console, under computer, instances, I can see hostname under "Custom metadata". This appears to be a new, custome key - it has no impact on

Configuring FQDN for GCE instance on startup

不羁的心 提交于 2019-12-01 07:13:45
问题 I am trying to start a google compute engine (GCE) instance with a pre-configured FQDN. We are intending to run an application that is licensed based on the contents of /etc/hosts. I am starting the instances using the Google Cloud SDK utility - gcloud. I have tried setting the "hostname" key using the metadata option like so: gcloud compute instances create mynode (standard opts) --metadata hostname=mynode.example.com Whenever I log into the developer console, under computer, instances, I

How do I get the local hostname if unresolvable through DNS in Java?

回眸只為那壹抹淺笑 提交于 2019-11-30 17:40:23
This sounds like something that should have been asked before, and it has sort of, but I'm looking to get the local hostname and IP addresses of a machine even when it is not resolvable through DNS (in Java). I can get the local IP addresses without resolution by iterating through NetworkInterfaces.getNetworkInterfaces() . Any answers to this question I've found indicate to use getLocalHost() InetAddress localhost = java.net.InetAddress.getLocalHost(); hostName = localhost.getHostName(); but this throws an UnknownHostException if the hostname isn't resolvable through DNS. Is there no way to

How can I add hostnames to a container on the same docker network?

空扰寡人 提交于 2019-11-30 12:51:18
Suppose I have a docker compose file with two containers. Both reference each other in their /etc/hosts file. Container A has a reference for container B and vice versa. And all of this happens automatically. Now I want to add one or more hostnames to B in A's hosts file. How can I go about doing this? Is there a special way I can achieve this in Docker Compose? Example: 172.0.10.166 service-b my-custom-hostname Yes. In your compose file you can specify network aliases . services: db: networks: default: aliases: - database - postgres In this example, the db service could be reached by other

How to reach docker containers by name instead of IP address?

为君一笑 提交于 2019-11-30 08:07:25
Is there a way I can reach my docker containers using names instead of ip addresses? I've heard of pipework and I've seen some dns and hostname type options for docker, but I still am unable to piece everything together. Thank you for your time. I'm not sure if this is helpful, but this is what I've done so far: installed docker container host using docker-machine and the vmwarevsphere driver started up all the services with docker-compose I can reach all of the services from any other machine on the network using IP and port I've added a DNS alias entry to my private network DNS server and it

Setting the Hostname in IIS Bindings Breaks Website

只谈情不闲聊 提交于 2019-11-30 06:53:24
I just got a Windows Server 2008 VPS and I'm having trouble getting IIS7 setup. I created a new website in IIS with the path, ip address, and hostname (like 'www.nameofsite.com') and click OK. When I browse to the site it pulls up " http://www.nameofsite.com " in the browser and... nothing... IE cannot display this webpage. If I blank out the hostname in the bindings and click [Browse] it works fine (it takes me to http://10.10.2.92 - the computer's ip). So entering the hostname breaks the website. Any ideas on what I'm missing? Services I might not have running or roles I'm missing? No server

How do I configure the hostname for Rails ActionMailer?

拟墨画扇 提交于 2019-11-30 04:46:03
I'm working on a fairly traditional forgot password email - I want to email the user a password change token embedded in a link that they can click on in order to change their password. I'm emailing via the traditional ActionMailer. If I use a normal link_to tag <%= link_to "click here", :controller => foo, :action => 'bar', :token => token %> I get a relative link - rather useless from an email. If I add in :only_path => false , then it errors saying I need to set default_url_options[:host] . The ActionController docs imply that you do that by overriding the #default_url_options methods in

What is the maximum length of a DNS name

让人想犯罪 __ 提交于 2019-11-30 03:02:58
I saw several mentions that the maximum string length of a DNS name (domain name) is 253 characters. Wikipedia seems to be referring this old blog post: https://en.wikipedia.org/wiki/Hostname http://blogs.msdn.com/b/oldnewthing/archive/2012/04/12/10292868.aspx On the other hand, if I understood the RFC, this article is wrong. DNS name maximum string length should be 250 ASCII characters instead of 253 based on the following byte sequence which as per RFC1035 is maxed to 255 bytes: To simplify implementations, the total length of a domain name (i.e., label octets and label length octets) is