nginx reload fails with [emerg] host not found in upstream

groknaut nginx-forum at nginx.us
Fri Dec 7 06:22:50 UTC 2012


maybe this one's better:

12/07 06:19[root at proxy2-prod-ue1 ~]# cat gethostbyname.c 
#include <stdio.h>
#include <netdb.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>

int main(int argc, char *argv[])
{
    if (argc < 2) {
        fprintf(stderr, "usage: %s hostname\n", argv[0]);
        return 1;
    }

    // skip 0 because that is the program name
    for (int i = 1; i < argc; ++i) {

        struct hostent *lh = gethostbyname( argv[i] );

        if (lh) {
                struct in_addr **addr_list;
                addr_list = (struct in_addr **) lh->h_addr_list;

            printf("%-14s %s\n",
                inet_ntoa( *addr_list[0] ),
                lh->h_name
            );
        }
        else {
            herror("gethostbyname");
        }
    }

    return 0;
}
12/07 06:20[root at proxy2-prod-ue1 ~]# gcc -std=c99 gethostbyname.c -o
gethostbyname.bin
12/07 06:20[root at proxy2-prod-ue1 ~]# ./gethostbyname.bin
webapp02c.prod.romeovoid.com
10.51.23.17  webapp02c.prod.romeovoid.com
12/07 06:21[root at proxy2-prod-ue1 ~]# ./gethostbyname.bin
webapp06c.prod.romeovoid.com
10.195.76.80 webapp06c.prod.romeovoid.com


our DNS does work..

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,233661,233664#msg-233664



More information about the nginx mailing list