Answer for KodeKloud Question -Linux Network Services

 Our monitoring tool has reported an issue in Stratos Datacenter. One of our app servers has an issue, as its Apache service is not reachable on port 3000 (which is our Apache port). The service itself could be down, the firewall could be at fault, or something else could be causing the issue.

Use tools like telnet, netstat, etc. to find and fix the issue. Also make sure Apache is reachable from the jump host without compromising any security settings.

sample Answer:

#first of all , do telnet to all the app servers from jump host ( "port" as per your question )

    telnet <app-server-01-IP> <port>

    telnet <app-server-02-IP> <port>

    telnet <app-server-03-IP> <port>

*you will find from the above step that one of the app servers will not connect. login to that server( in my case its app server 01 )

    ssh <user>@<app-server-01-IP>

#switch to roo user 

    sudo su 

#now, check the apache service status 

    systemctl status httpd 

* if httpd not running start the service

    systemctl start httpd 

#if you get an error form the above start command try to find the error using the below command 

    httpd -t

* it will show you the error, correct that error ( in my case ServerName needs to be added to httpd.conf file)

    vi /etc/httpd/conf/httpd.conf

ServerName <app-server-01-IP>:<port>

*save the file and start the apache service 

    systemctl start httpd 

* still not started?

 #let's verify the Listen port to find any services running on the same apache port.

    netstat -anp | grep <port as per your question>

* it will show you the service which is blocking the apache service

 #kill that service 

    kill -9 <pid>

#now start the apache service 

    systemctl start httpd 

#now try telnet to app server 01 from jump host, 

    telnet <app-server -01-IP> <apache port>

Still, you are not connected to the server? follow the steps below 

# in app server 01 (check the iptables entry)

    iptables -S 

#add a rule (port should be your apache port as per your question)
     
    iptables -I INPUT -p tcp -m tcp --dport <your apache port> -j ACCEPT

# save the rule 
    
    service iptables save
    
##now try telnet to app server 01 from jump host

    telnet <app-server -01-IP> <apache port>

*Please comment on this post if you facing any issues in the steps, also provide your feedback in the comments :)

Note: **The Question copied it for learning purposes.** Commands are correct but based on your question the server, user name, and other details might differ, so please do check.

No comments:

Post a Comment

Featured Post

Answer for Kodekloud DEVOPS Questions - Init container in Kubernetes

Question: 1. Create a Deployment named as ic-deploy-devops. 2. Configure spec as replicas should be 1 , labels app should be ic-devops , ...