Jenkins Amazon EC2 plugin and proxy - jenkins

I am trying to use the Amazon EC2 jenkins plugin. But when I configure it I get:
java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:337)
at com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.connectSocket(SdkTLSSocketFactory.java:132)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
Caused: org.apache.http.conn.ConnectTimeoutException: Connect to sts.amazonaws.com:443 [sts.amazonaws.com/54.239.29.25] failed:
...
I assume this is, because sts.amazonaws.com is reachable only through a proxy from the jenkins instance.
Can I somehow make the plugin use the proxy?

Related

Connection refused when trying to create graph in JanusGraph-Docker

I'm using the JanusGraph-Docker images (https://github.com/JanusGraph/janusgraph-docker) to set up JanusGraph in Docker. When I used JanusGraph without docker everything worked fine for me, but now I've ran into some issues:
I've used the following command to set up janusgraph with Cassandra+Elasticsearch:
docker-compose -f docker-compose-cql-es.yml up
This starts all the required containers, which I double checked with:
docker ps
Now I want to connect to Janusgraph via Gremlin console using:
docker-compose -f docker-compose-cql-es.yml run --rm -e GREMLIN_REMOTE_HOSTS=janusgraph janusgraph ./bin/gremlin.sh
This starts the gremlin console and I configure the remote with:
:remote connect tinkerpop.server conf/remote.yaml
:remote console
Which works fine aswell. After that I try to create a new graph, which fails with:
graph = JanusGraphFactory.open('conf/janusgraph-cassandra-es.properties')
This gives me the following message:
Connection refused (Connection refused)
Full Stack Trace:
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.thrift.transport.TSocket.open(TSocket.java:182)
at org.apache.thrift.transport.TFramedTransport.open(TFramedTransport.java:81)
at org.janusgraph.diskstorage.cassandra.thrift.thriftpool.CTConnectionFactory.makeRawConnection(CTConnectionFactory.java:110)
at org.janusgraph.diskstorage.cassandra.thrift.thriftpool.CTConnectionFactory.makeObject(CTConnectionFactory.java:74)
at org.janusgraph.diskstorage.cassandra.thrift.thriftpool.CTConnectionFactory.makeObject(CTConnectionFactory.java:43)
at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1220)
at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftStoreManager.getCassandraPartitioner(CassandraThriftStoreManager.java:215)
at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftStoreManager.(CassandraThriftStoreManager.java:197)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:58)
at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:440)
at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:411)
at org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder.build(GraphDatabaseConfigurationBuilder.java:50)
at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:161)
at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:132)
at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:79)
at org.janusgraph.core.JanusGraphFactory$open.call(Unknown Source)
at Script4.run(Script4.groovy:1)
at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:674)
at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:376)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
I can run queries such as the following since janusgraph server seems to pre-deploy a graph with a traversal object:
g.addV('user').property('username','exampleUserName')
But when I'm trying to connect from python gremlin with:
graph = Graph()
g = graph.traversal().withRemote(DriverRemoteConnection('ws://0.0.0.0:8182/gremlin','g'))
I get the same error, any help?
Note that when your server listens on 0.0.0.0, that means it will be accessible from machines other than the one that it's running on. The alternative of listening on 127.0.0.1 means it will only be accessible from processes on the same host as the server is running.
However, when your client is connecting to a server, it must specify the actual hostname or IP address it is connecting to, which could be localhost or 127.0.0.1 or whatever is the IP address that the server is connected to on the network. However, you cannot use 0.0.0.0 in the connection string from the client to the server, as that's not a valid IP address to connect to.

Connect to localhost slave node from Jenkins docker container

I do want to connect my Jenkins master slave in a docker container to my localhost machine node slave(to be accurate my macOS High Sierra).
Here you are the steps I followed:
Run docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts.
Go to Manage Jenkins. Click on Manage Nodes.
Launch method, select: Launch slave agents on Unix machines via SSH
Host: 192.168.1.33, 127.0.0.1, localhost, 0.0.0.0
Credentials: Username and password or SSH username with private key.
I don't know what ip I should put in the Host field and which option to select in Credentials field. I've already tried several combinations but I don't get any result. In addition, when I make a ping from my container to my localhost, it is always successful.
How Can I setup the Host and Credentials fields in order to connect to my local host node slave without having to use the Launch slave agents via Java Web Start
I always get this error:
SSHLauncher{host='192.168.1.33', port=22, credentialsId='4bc9a817-edae-4806-bc55-2f5b4f5b03e7', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=210, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[09/23/18 21:24:39] [SSH] Opening SSH connection to 192.168.1.33:22.
Connection refused (Connection refused)
SSH Connection failed with IOException: "Connection refused (Connection refused)", retrying in 15 seconds. There are 10 more retries left.
Connection refused (Connection refused)
SSH Connection failed with IOException: "Connection refused (Connection refused)", retrying in 15 seconds. There are 8 more retries left.
Connection refused (Connection refused)
SSH Connection failed with IOException: "Connection refused (Connection refused)", retrying in 15 seconds. There are 9 more retries left.
Connection refused (Connection refused)
SSH Connection failed with IOException: "Connection refused (Connection refused)", retrying in 15 seconds. There are 7 more retries left.
Is your slave node listening on port 22 for SSH connections ?
If yes, are you able to telnet 192.168.1.33 22 from Jenkins master ?
If no, install a basic SSH server on your slave node like open
openssh and try again ?
I just got this working with a Jenkins Docker container with my mac as the slave node.
For the Host field enter the output of the "hostname" command when you run it on terminal. To set the credential field, make a Jenkins credential with your username and password for your mac (whatever credential works when you run ssh localhost on terminal).
I also have the field "Host Key Verification Strategy" set to "non verifying Verification Strategy." But you may not need this if you manually run the ssh command on your terminal and accept the key

Not able to run neo4jshell : Connection refused

I am trying to follow the steps listed here https://neo4j.com/developer/kb/fulltext-search-in-neo4j/
I am using version 3.4.4
to try out full text search. I am not able to run the neo4jshell. I always get the following error :
$ ./neo4j-shell
ERROR (-v for expanded information):
Connection refused
-host Domain name or IP of host to connect to (default: localhost)
-port Port of host to connect to (default: 1337)
-name RMI name, i.e. rmi://<host>:<port>/<name> (default: shell)
-pid Process ID to connect to
-c Command line to execute. After executing it the shell exits
-file File containing commands to execute, or '-' to read from stdin. After executing it the shell exits
-readonly Connect in readonly mode (only for connecting with -path)
-path Points to a neo4j db path so that a local server can be started there
-config Points to a config file when starting a local server
Example arguments for remote:
-port 1337
-host 192.168.1.234 -port 1337 -name shell
-host localhost -readonly
...or no arguments for default values
Example arguments for local:
-path /path/to/db
-path /path/to/db -config /path/to/neo4j.config
-path /path/to/db -readonly
java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:338)
at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:112)
at java.rmi.Naming.lookup(Naming.java:101)
at org.neo4j.shell.impl.RmiLocation.getBoundObject(RmiLocation.java:191)
at org.neo4j.shell.impl.RemoteClient.findRemoteServer(RemoteClient.java:72)
at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:65)
at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:46)
at org.neo4j.shell.ShellLobby.newClient(ShellLobby.java:203)
at org.neo4j.shell.StartClient.startRemote(StartClient.java:353)
at org.neo4j.shell.StartClient.start(StartClient.java:229)
at org.neo4j.shell.StartClient.main(StartClient.java:147)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:211)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 13 more
I have tried the localhost, port etc options as well. No luck. Do I have to do any configuration changes?
Please help!
Neo4j-shell is deprecated, try using cypher-shell instead.

Not able to connect to redis server from docker container

My docker version is 1.13.1.
I am trying to connect to redis-server from my docker container,but I am getting connection refused error.Detailed logs are given below:
Caused by: redis.clients.jedis.exceptions.JedisConnectionException:
java.net.ConnectException: Connection refused
at redis.clients.jedis.Connection.connect(Connection.java:207) [jedis-2.9.0.jar:]
at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:93)
[jedis-2.9.0.jar:]
at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1767)
[jedis-2.9.0.jar:]
at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:106)
[jedis-2.9.0.jar:]
at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:888)
[commons-pool2-2.4.3.jar:2.4.3]
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:432)
[commons-pool2-2.4.3.jar:2.4.3]
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:361)
[commons-pool2-2.4.3.jar:2.4.3]
at redis.clients.util.Pool.getResource(Pool.java:49) [jedis-2.9.0.jar:]
... 27 more Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method) [rt.jar:1.7.0_80]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
[rt.jar:1.7.0_80]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
[rt.jar:1.7.0_80]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
[rt.jar:1.7.0_80]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) [rt.jar:1.7.0_80]
at java.net.Socket.connect(Socket.java:579) [rt.jar:1.7.0_80]
at redis.clients.jedis.Connection.connect(Connection.java:184) [jedis-2.9.0.jar:]
... 34 more
when i give --net="host" option this error is gone,but when i give
--add-host=parent-host:`ip route show | grep docker0 | awk '{print \$9}'`
I get the error,although the container is able to connect to Db on a different VM,but not connecting to redis-server present on self hosting machine.
I suspect the problem is that you are trying to connect to redis via localhost rather than parent-host. Make sure that you are connecting to redis via parent-host when creating the Jedis connection.
The reason --net=host option works, is that in this case localhost will refer to the IP of the host machine and not to that of the container.
Also, make sure that there is an enty for parent-host in /etc/hosts inside the container.

Neo4j remote shell connection refused on AWS database server

My Neo4j database server is hosted in AWS.
I am using from my Mac this command:
$ ./bin/neo4j-shell -host xx.xxx.xxx.xxx -port 1337 -name shell
The port 1337 is enabled in the AWS Neo4j database server.
I have these lines uncommented in the file neo4j.properties:
remote_shell_enabled=true
remote_shell_host=127.0.0.1
remote_shell_port=1337
I am getting the error: Connection refused
Having the details:
java.rmi.ConnectException: Connection refused to host: xx.xxx.xxx.xxx; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:341)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:101)
at org.neo4j.shell.impl.RmiLocation.getBoundObject(RmiLocation.java:261)
at org.neo4j.shell.impl.RemoteClient.findRemoteServer(RemoteClient.java:69)
at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:62)
at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:45)
at org.neo4j.shell.ShellLobby.newClient(ShellLobby.java:178)
at org.neo4j.shell.StartClient.startRemote(StartClient.java:302)
at org.neo4j.shell.StartClient.start(StartClient.java:179)
at org.neo4j.shell.StartClient.main(StartClient.java:124)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:208)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:147)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 13 more
Don't know how to fix it.
I think you have to open quite a few ports on your server, besides 1337 and 1099 also a port range for RMI ports.
e.g. What port is used by Java RMI connection?
you can also use neo4j over http (e.g. in the browser with /webadmin) or via this script: https://gist.github.com/jexp/a9bf4cd3a16eb6c5997b
This key remote_shell_host=127.0.0.1 that enables you to just connect via loopback. You have to specify by which network adapter you will receive the connection. You can also specify 0.0.0.0 for any your network interfaces.

Resources