среда, 25 апреля 2012 г.

How to connect to postgreSQL database through the network

How to connect to postgreSQL database through the network (linux - debian system)

First you have start the postgreSQL server....

# /etc/init.d/postgresql start

step:1 Allow remote access to postgresql database....


First you open the file called /etc/postgresql/pg_hba.conf.

# vim /etc/postgresql/8.1/main/pg_hba.conf

Now append the following line.

host all all ip_address net_mask auth_method


"ip_address" means your ip. "net_mask" means net mask. "auth_method" means authentication method. There are few authentication methods. such as "password, trust, md5" like that...

eg:
host all all 192.168.0.2 255.255.255.0 trust

When we add auth_method as 'trust', think as trust user. If we add as 'md5', have to issue password while connect to this machine.

more details on postgresql doc

then save and close

step:2 Allow TCP/IP communication

open the file called /etc/postgresql/8.1/main/postgresql.conf. (8.1 means version. It may be vary)

Uncomment "listen_addresses" option.

It's default value is "localhost" and change to '*'.


Finally restart the postgresql database server..

# /etc/init.d/postgresql restart

step:3 Try to connect from remote machine


# psql -h 192.168.0.21 -U postgres d- test

-h means host
-U means user name
-d means database name

enjoy...........

From http://chamathg.blogspot.com/2007/08/how-to-connect-to-postgresql-database.html

пятница, 30 марта 2012 г.

Иногда возникает необходимость работать с несколькими серверами используя ssh.
Некоторые неудобства доставляет то, что часто надо подключаться и вводить пароль.
Можно воспользоваться методом аутентификации, основанном на паре ключей.

Для этого достаточно сгенерировать личный ключ на локальном компьютере:
localuser@local-machine:~$ ssh-keygen -t rsa
Команда создаст (если её еще нет) директорию .ssh в домашнем каталоге и запишет в неё файл id_rsa.pub с ключом.


Далее необходимо зайти на сервер и создать в папке ~/.ssh файл authorized_keys.

Затем поместить в этот файл строку из файла id_rsa.pub, который вы сгенерировали на локальной машине.

Добавлять в файл authorized_keys можно сколько угодно таких записей.

В итоге мы получаем доступ к удаленной системе без ввода пароля.

вторник, 10 января 2012 г.

export HGENCODING=UTF-8

Чтобы PyCharm не тупил с кодировкой меркуриала: echo export HGENCODING=UTF-8 >> .profile