mongod Failed to obtain address information for hostname OS X - macos

Having an issue starting mongo using mongod --dbpath. I get the following error:
NETWORK [HostnameCanonicalizationWorker] Failed to obtain address information for hostname ##########: nodename nor servname provided, or not known
Host name only has latin characters. I've tried multiple networks, deleted all DNS entries, confirmed my /etc/hosts looks fine and now I'm at a standstill.
Here is my /etc/hosts:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
#::1 localhost

Try enabling the ipv6 and restart the mongod server
::1 localhost

I followed the answer in this JIRA ticket.
And here is my /etc/hosts file.
1 ##
2 # Host Database
3 #
4 # localhost is used to configure the loopback interface
5 # when the system is booting. Do not change this entry.
6 ##
7 # 127.0.0.1 localhost
8 127.0.0.1 localhost localhost.localdomain
9 255.255.255.255 broadcasthost
10 # ::1 localhost

change your HOSTNAME in /etc/sysconfig/network likes:
HOSTNAME=Steven
Then change your hostname in /etc/hosts:
127.0.0.1 localhost localhost.localdomain ...............
to
127.0.0.1 localhost Steven ...............

Related

cannot add new host to mac OS X

I am trying to add new entry to the /etc/hosts in mac os (el Capitan)
how ever when I try to ping this entry , I am getting error of not resolved
there is no nsswitch file
what am I missing?
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
local.datafabric.io localhost
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
In the man page for the hosts file
man hosts
the syntax is explained:
IP_address canonical_hostname [aliases...]
so, if you want to add the name local.datafabric.io as an alias for localhost (127.0.0.1), the line should look like this:
127.0.0.1 localhost local.datafabric.io
man is your friend.
You will probably also want to flush your dnscache. The correct commands for that are depending on the actual version of MacOS.

Cannot block specific websites

I've been able to block Youtube and Facebook sites, but not amazon or google. Why? Seems these two websites have something different. Thanks
Bernardos-MacBook-Pro:~ bernardo$ sudo nano /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 www.youtube.com
127.0.0.1 http://www.amazon.es
127.0.0.1 https://www.google.es
127.0.0.1 www.facebook.com
try it without http:// like on facebook and youtube

sqlplus remote connection giving ORA-21561

I have installed sqlplus based on instruction given here
sqlplus 'username/password#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.100)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))'
This is giving me error
SQL*Plus: Release 11.2.0.4.0 Production on Fri Jul 10 16:10:38 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-21561: OID generation failed
Enter user-name:
What is the solution for this problem?
PS: I have already added hostname and hosts have already have value.
Append the name of your server to the hosts file.
If your /etc/hosts file looks like this:
127.0.0.1 localhost localhost.localdomain
It should be changed to:
127.0.0.1 localhost localhost.localdomain hostname
hostname can be obtained from the command "hostname".
If you are using Mac add local computer name to your 127.0.0.1 in /etc/hosts
It will be like
127.0.0.1 localhost <local_computer_name>
Way to find local computer name
System Preferences>Sharing(search for it if you cant find)
on the top you can see your local computer name
or you can use "hostname" command to get local computer name
This issue can also be cause by wrong permissions on the /etc/hosts file. If it is not readable for the Oracle uid, the errors will show.
Make sure your /etc/hosts is readable by everybody:
$ ls -l /etc/hosts
-rw-r--r-- 1 root system 7446 Mar 28 23:03 /etc/hosts
$
Answer obtained here.
1 - Get your hostname:
$ hostname
new-host
2 - Change the contents of /etc/hosts:
$ sudo cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
$ sudo nano /etc/hosts
$ sudo cat /etc/hosts
127.0.0.1 localhost new-host
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Hope this helps (:
look at /etc/sysconfig/network
change if needed the hostname
try this, don't put single quotes
sqlplus username/password#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.100)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))

ping: cannot resolve localhost: Unknown host OS X

127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
This is my /etc/hosts file but it's really strange failure to ping and cannot resolve localhost.
It's work well like ping gonjay when I add
127.0.0.1 gonjay
to my hosts file.
I fixed it by making sure that hosts file used Unix line endings (I used Sublime Text for this)
I have solved the problem by restoring my Hosts file (it was empty):
But before, you have to check your hosts file.
cat /etc/hosts
If nothing is shown, that means your hosts file is empty.
Then just copy and paste this over the existing hosts file then save it as plain text to restore it.
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
If your hosts file is not empty, your can try to delete it and add it again with this lines.
Probably will help for those who don't know how make Unix line endings
brew install dos2unix
sudo dos2unix -c mac /private/etc/hosts
That will convert your perfectly fine hosts file to UNIX encoding.

How to redirect a website

Within the /etc/hosts file you can block traffic via
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
# Block Adobe Activation
127.0.0.1 activate.adobe.com
127.0.0.1 practivate.adobe.com
127.0.0.1 ereg.adobe.com
127.0.0.1 activate.wip3.adobe.com
127.0.0.1 wip3.adobe.com
127.0.0.1 3dns-3.adobe.com
127.0.0.1 3dns-2.adobe.com
127.0.0.1 adobe-dns.adobe.com
127.0.0.1 adobe-dns-2.adobe.com
127.0.0.1 adobe-dns-3.adobe.com
127.0.0.1 ereg.wip3.adobe.com
127.0.0.1 activate-sea.adobe.com
127.0.0.1 wwis-dubc1-vip60.adobe.com
127.0.0.1 activate-sjc0.adobe.com
127.0.0.1 hl2rcv.adobe.com
#127.0.0.1 reddit.com
#127.0.0.1 www.reddit.com
However I want to redirect these websites to another website I have online informing the user this is blocked content
You cannot redirect to a website per se - the only think you can try is to get the ip address the website is hosted on and if the server is set to handle the request, it will work. That means it's not going to work on shared servers that has one IP.
For more sophisticated redirect, you have to use other solution.
Instead of setting those IPs to 127.0.0.1 set them to the IP of the "Sorry, blocked" server

Resources