Skip to main content

Posts

Showing posts from March, 2012

Test your apache config file

Test your apache config file

This is a quick note to remind you about the command to test your apache config file before actually restarting apache:

You can check your configuration files for syntax errors without starting the server by usingapachectl configtestor the-tcommand line option.




Source: Apache Docs
Here is some basic iptable rules.  Thanks goes to the cloud support team at Rackspace.  

This rule appends the rule.  This particular rule  opens inbound port 5432 to the ipaddress 111.222.33.44


iptables -A RH-Firewall-1-INPUT -p tcp -s 111.222.33.44 --dport 5432 -j ACCEPT
This rule inserts the rule at the start of the chain.  

iptables -I RH-Firewall-INPUT -s 111.222.33.44 -p tcp -m tcp --dport 5432 -j ACCEPT
After adding rules you need to issue this command to save the rules.

service iptables save
After saving you need to issue the restart command
service iptables restart
If you want to see the available chains in your firewall use this command:
iptables -L

Using Vacuumdb in PostgreSQL

I read in the PostgreSQL docs that vacuumdb or vacuum should be used on the databases every day. I have been running it manually the last couple of days and it has made a difference on query response times. I highly recommend using it.

To vacuum one database from the command line.


vacuumdb -d MyDB -v  -z -U postgres


To vacuum one database from the command line.



vacuumdb -a -v  -z -U postgres

-d = database name
-v = verbose output
-z = analyze
-U = username
-a = vacuum all databases

How to create a database in PostgreSQL

Today I needed to create a database with SQL_ASCII encoding.

Here is the command I used:

CREATE DATABASE MyDB ENCODING 'SQL_ASCII' TEMPLATE template0; I had to use template0 because template1 was set to UTF8.

I still need to dig in on the templates and what they are all about.

How to resume a ctrl-z stopped job

Today before I knew how to exit a psql command prompt in PostgreSQL I used ctrl-z to exit. I wanted to get back into psql so I went to Google to find out how. This time SuperUser.com came to my rescue.

It is as simple as this:

fg

Read the post for other options, but the above is what I needed.  Worked like a charm

PostgreSQL on the command line

I am just getting back into PostgreSQL.  Here are the things I had to learn today:

1.  Command line usage:
su - postgrespsqlselect version(); 2.  Dumping data for import on another server
pg_dump -o mydb -U postgres -W > mydb.sql -o has to do with oids (Not sure if I need this yet) -U is for user-W is for password.  It prompts when you run the command

IIS 7 Coldfusion 500 error

This is a reminder to people that might be getting a 500 error when creating a site in IIS7 with coldfusion support.  I used the Coldfusion web config tool but was still getting a 500 error.  I then remembered it was a 64bit machine but it was Coldfusion was 32bit.  I had to go into the advance settings for the application pool and set Enable 32-bit Applications to true.