The CLI establishes a tunnel between a VS Code client and your remote machine. Install the code CLI on a remote machine you'd like to develop against from a VS Code client. You may create and use tunnels through the code CLI. We'll describe both paths in the sections below. Using the VS Code Desktop UI is convenient if you're already doing some work in VS Code and would then like to enable tunneling for your current machine. The CLI is a great option if you can't install the full VS Code Desktop on your remote machine. Enable tunneling through the VS Code Desktop UI.īoth of these paths result in the same tunneling functionality – you can use whichever tooling works best for you.Run the tunnel command of the code command-line interface (CLI).VS Code can provide a local-quality development experience - including full IntelliSense (completions), code navigation, and debugging - regardless of where your code is hosted. This can eliminate the need for source code to be on your VS Code client machine since the extension runs commands and other extensions directly on the remote machine. Tunneling securely transmits data from one network to another. You can connect to that machine from a VS Code client anywhere, without the requirement of SSH. The Visual Studio Code Remote - Tunnels extension lets you connect to a remote machine, like a desktop PC or virtual machine (VM), via a secure tunnel. Configure IntelliSense for cross-compiling.Host_name="'primary_host_name': 'win-3auvcutkp34'" The working code to connect to mongodb, when the ssh and mongo both have different credentials: def Collect_Pid_DB(hostname,user,password,accountid): Hence in the above code mentioned in the question was not working. The following is the working code for the above question, In the above code the issue was that the local bind port along with the url was not parsed into a proper format, hence when authenticating the port couldnt be authenticated in order to connect. Server = lect_server(read_preference)įile "/usr/local/lib/python2.7/dist-packages/pymongo/topology.py", line 226, in select_serverįile "/usr/local/lib/python2.7/dist-packages/pymongo/topology.py", line 184, in select_serversįile "/usr/local/lib/python2.7/dist-packages/pymongo/topology.py", line 200, in _select_servers_loop Print(json.dumps(db.collection_names(), indent=2))Īctual results: Database(MongoClient(host=, document_class=dict, tz_aware=False, connect=True), u'MissingPatches')Ĭollect_Pid_DB('192.142.123.142','root','password','mydatabasename')įile "duplicate.py", line 35, in Collect_Pid_DBįile "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line 787, in collection_namesįile "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line 722, in list_collectionsįile "/usr/lib/python2.7/contextlib.py", line 17, in _enter_įile "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py", line 1135, in _socket_for_reads Uri = "mongodb://admin:" + + = pymongo.MongoClient(uri,server.local_bind_port) Here the ssh connection is happening, whereas the mongodb is not getting connected def Collect_Pid_DB(): I tried passing the username and password of ssh in ssh tunnel server, and the mongodb credentials in the client, but getting an error stating: : 127.0.0.1:27017: Connection refused I am trying to connect to remote mongodb, here the ssh access has a different username and password, And the mongodb has a different username and password.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |