Versiones comparadas

Clave

  • Se ha añadido esta línea.
  • Se ha eliminado esta línea.
  • El formato se ha cambiado.

Ahora se describirán los pasos que hay que llevar a cabo para establecer la conexión con la máquina mediante SSH/WinSCP. Se trasladará el script de modificación de base de datos, generado como se especificó en la sección anterior desde la máquina local a la máquina remota y se ejecutará.

 

Se utilizará WinSCP para hacer el envío al sistema remoto, y se ejecutará el script en el sistema remote desde una sesión de PuTTY. Ya que el script tiene pocas líneas, también se podría no utilizar WinSCP y utilizar un editor de texto de terminal (como nano) para crear directamente los contenidos del script en el sistema remoto.

 

...

1-      Antes de llevar a cabo la conexión a la máquina será necesario disponer de:

...

  • La dirección IP (o host address) de la máquina.
  • Un puerto 22 abierto en la máquina para la conexión (u otro puerto habilitado para ssh)
  • Los credenciales de autenticación para conectarse a la máquina

...

2-      Conexión mediante PuTTY

...

...

3-  Una vez arrancado SSH se debería tener acceso al sistema de archivos de la máquina. Desplazarse al directorio donde se creará y se ejecutará el script. En este manual se utilizó el directorio /home/fuseadmin/Descargas/

...

cd ~/Descargas/

Si no se desea utilizar WinSCP, una vez hechas las ediciones necesarias en el script, se puede abrir un editor de texto y crear el script directamente desde la sesión en PuTTY utilizando nano.

nano GeneracionDatos.sql

...

The steps to be performed to establish the connection to the machine using SSH/WinSCP will now be described. It will move the database modification script, generated as specified in the previous section from the local machine to the remote machine and will run.

WinSCP will be used to send to the remote system, and the script will be executed on the remote system from a PuTTY session. Since the script has few lines, you could also not use WinSCP and use a terminal text editor (such as nano) to directly create the contents of the script on the remote system.


1-      Before carrying out the connection to the machine it will be necessary to have:

  • The IP address (or host address) of the machine.
  • An open port 22 on the machine for connection (or another ssh-enabled port)
  • Authentication credentials to connect to machine

2-      Connection via PuTTY

  • If you do not have it, you can download PuTTY from the following location
  • The IP address to which to connect is written in the main window of Putty.
  • The port is written, for SSH connections it is usually used port 22)
  • In the login window, the authentication credentials are written.

3-  Once the SSH is started, the file system of the machine should be accessible. Navigate to the directory where the script will be created and run. This manual used the directory /home/fuseadmin/Downloads/

cd ~/Downloads/

If you do not want to use WinSCP, once you have made the necessary edits to the script, you can open a text editor and create the script directly from the PuTTY session using nano.

Nano GenerationDatos.sql

Paste the contents, save (Ctrl + O) and exit nano (Ctrl + X)


4-

      Conexión mediante WinSCP

Una vez hecho el login, y una vez llevadas a cabo las ediciones del script necesarias descritas en las siguientes secciones, se puede arrastrar el archivo utilizando el puntero desde nuestro sistema de archivos local al sistema de archivos remoto utilizando la interfaz gráfica de WinSCP

5-      Una vez hayamos cambiado los datos del script, lo ejecutamos, hay dos métodos para ejecutarlo: Desde comando de terminal o desde interfaz gráfica con pgadmin.

a-      Se puede ejecutar el script directamente desde una terminal, indicando como argumento la ubicación del script

Caso Fuse

     Connecting via WinSCP

  • If you do not have it installed, it is possible to download WinSCP from this location
  • The SFTP protocol is chosen as the file transfer protocol.
  • Enter the IP address
  • User credentials are entered.

Once logged in, and once the necessary script editions have been performed described in the following sections, you can drag the file using the pointer from our local file system to the remote file system using the WinSCP graphical interface

5-      Once we have changed the data of the script, we execute it, there are two methods to execute it: From terminal command or from graphical interface with pgadmin.

a-      You can run the script directly from a terminal, indicating as an argument the location of the script

Fuse Case

psql -U fuseadmin -d siiprod_db -a -f ~/

Descargas

Downloadss/fuse_conf/scripts-sql/GeneraciondetablasPostgreSQLv1.sql

Caso

Pasarela Case

psql -U fuseadmin -d siiprod_db -a -f ~/

Descargas

Downloadss/fuse_conf/scripts-sql/GeneraciondetablasPostgreSQLPASARELAv1.sql

b-

      Ejecución mediante pgadmin (si tenemos disponible la opción gráfica desde SSH)
  • Si el usuario de base de datos es el mismo entre sistemas no es necesario cambiarlo, si no, habra que cambiar el OWNER en todas las tablas
  • Abrir pgadmin3
  • Se pulsa sobre el icono de sql
  • Se pega el contenido del script y se ejecuta

        Execution using pgadmin (if the graphic option is available from SSH)

    • If the database user is the same between systems it is not necessary to change it, otherwise, it will have to change the OWNER in all the tables
    • Open pgadmin3
    • Click on the sql icon
    • Script content is pasted and executed