How to recover jobs in Jenkins after port number change? - jenkins

I created Jenkins in default port 8080. After a week time some other organization level application takeover 8080 port now i am unable to connect to my jenkins.
So i thought of changing port number by running "java -jar jenkins.war --httpPort=9090"
but when i connect using new port 9090,it says you can create new jobs and none of my existing jobs are being displayed.
I have created many jobs if i started again it will be rework. Is there any way to recover everything but port only changed?

Related

Jenkins return wrong port in jpnl file and in the job search

I migrated old Jenkins 1.651.3 running on an embedded Winstone server on port 8080.
To LTS Jenkins 2.346.3 and I run it next to old Jenkins in Tomcat 9 on the port 8082.
But the new Jenkins "doesn't know correctly its port."
When I download .jnpl file for connecting Windows agent it contains the wrong port 8080 instead of 8082.
When I use a search textbox on new Jenkins homepage. I will get links to jobs to the old jenkins (link contains port 8080 instead of 8082)
I cannot figure out how to tell Jenkins it's port?

JMeter master/slave across Ingress (Docker to Kubernetes) (how to get JMeter to only use one RMI port)

I have JMeter Master (5.3) running in a Docker container, triggered by a Jenkins pipeline containing a 'docker run' command. It communicates to JMeter slaves that are located in a Kubernetes namespace, with an Ingress controller to handle input. (For this trial I'm using just one slave but there may be multiple in the future)
The Docker JMeter Master container is aware of Ingress and can reference it by name or by IP address. From within the JMeter Master container I am able to ping the JMeter slave hostname and it is giving the Ingress IP address which I would expect.
Ingress in turn has the ability to communicate with the JMeter slave, but I can't get from JMeter Master to JMeter slave. I have set server.rmi.localport=80 on both sides, the JMeter slave seems to register port 80 in the logs.
The error from the JMeter Master is 'operation timed out (connection timed out)'. I'm not sure where to start looking?
(For reference, we cannot move JMeter Master into Kubernetes, but conversely the slaves need to stay in Kubernetes in order to provide the workload).
Edit: I've done some more investigation. The problem seems to occur that while the base RMI port is port 80, it's also trying to open port 81 and port 82. This will obviously fail as I've only got port 80 available through ingress.
So the question is now 'how do I tell JMeter to only use a single port for RMI'?
As an update to this, basically I've come to the conclusion that 'you can't do this'. While the ports can be opened on Ingress, RMI can't communicate over them. So even if I could get it all on one port, it still wouldn't work.
There is a 'RMI over HTTP' implementation but I wouldn't have first idea on how to put that into JMeter.
What I have done is add a small webserver to the pod, such that I can control JMeter through normal web calls. For example, the jmx file can be PUT on to the pod, and a GET command can retrieve the results. That way I can start the pod up in the relevant location, where it will wait for whatever tests we want to run. It's also extendable if I need additional functionality.

Port Address already in use: bind

Facing issues with Jenkins
With every restart I need to start Jenkins with some unique Port.
With every new launch I have to use cmd like:java -jar jenkins.war --httpPort=8081(new port everytime)
Note:I tried killing pid ports used earlier like 8080,8090,8081.
Please suggest how to resolve this on Windows.
Please help,how can we use the same ports again?

Kubernetes plugin containers can't connect back to Jenkins

I have a Jenkins and Kubernetes cluster running within the same network in AWS. Jenkins has it's own instance.
I have configured the Kubernetes plugin as follows:
The recommended JNLP docker image is used. Jenkins JNLP port is configured to be static 5000.
Now when I kick off the job, it shows me that the node is offline. When I click on the offline node I get this:
This makes me go to the k8 cluster. Running docker ps shows no containers running. However:
From there I go to find what docker container gets run and what logs it leaves after that:
I use:
https://github.com/jenkinsci/docker-jnlp-slave as image
https://github.com/jenkinsci/kubernetes-plugin
Jenkins version: 2.27
k8: hyperkube:v1.4.3_coreos.0
Jenkins does spin up the container, I guess it runs and errors out because no valid arguments are provided during the container run? I need it to be a hands off process where I don't have to log in to my containers (Java clients). How do I achieve this?
UPDATE
Based on this answer: kubernetes slaves cannot register to jenkins master
If I log into the container and run the command that Jenkins displays under the host that cannot connect:
java -jar /usr/share/jenkins/slave.jar -jnlpUrl https://test.myhost.com/computer/jenkinsminions-10f0b7d49054ac/slave-agent.jnlp -secret 62637e83008f50eb94483ad609e9a2719d313fa56e640e4beca9eebeaf0b1af2
The container connects via JNLP2 and the job runs.
I tried to add the arguments as suggested, but no luck. Containers still won't connect automatically:
Do you have a Root directory not writable message in the container log?
[...]
Exception in thread "main" java.lang.RuntimeException: Root directory not writable
at hudson.remoting.FileSystemJarCache.<init>(FileSystemJarCache.java:44)
at hudson.remoting.Engine.<init>(Engine.java:139)
at hudson.remoting.jnlp.Main.createEngine(Main.java:164)
at hudson.remoting.jnlp.Main.main(Main.java:148)
at hudson.remoting.jnlp.Main._main(Main.java:144)
at hudson.remoting.jnlp.Main.main(Main.java:110)
In this case, you might have a problem similar to this.
PS: If you cannot see the logs, try removing the "Allocate pseudotty" option

Hudson will not start on Windows 7? JNLP slave agent listener started on TCP port

I'd like to setup Hudson to work with Ant. I am using it for the first time, and when I try:
java -jar hudson.war it starts doing something, but stops on the line:
INFO: JNLP slave agent listener started on TCP port 59204
I am running Windows 7, also the Java Web Start for hudson does not start.
Check if that port is actually reachable from the node. At the node you can try to telnet MASTER_IP 59204. The Hudson master machine may have a firewall that's currently blocking such access.
Hudson by default uses a random port number for each node to connect via JNLP. You can configure it to use a fixed port number. This works well if you have a firewall and only want to expose a limited number of ports for connection from the outside. Go to Manage Hudson and change TCP port for JNLP slave agents to a fixed port number.

Resources