Friday, May 14, 2010

Dump only selected tables of a mysql database

If any case if you want to get the database dump of the selected tables of a mysql server.

  
mysqldump -u user -p DBname TB1 TB2 > dump.sql


if you want to ignore some of the tables

  
mysqldump -u user -p DBName --ignore-table=database.table1 --ignore-table=database.table2 > dump.sql

Thursday, May 13, 2010

Enable Apache proxy Service (mod_proxy / proxy_http)

Apache proxy is used to expose different services (running on different ports) to public as standard http, https ftp services. Its act as the middle layer in between back-end and public.

Earlier apache came with mod_proxy module but it has been replaced with proxy_http module in new apache versions(2.2.12).




1) Enable proxy_http or mod_proxy module
a2enmod proxy_http or a2enmod mod_proxy

2) Restart the server.
/etc/init.d/apache2 restart

2) Do the virtual hosting. following vhost for http proxy service.

assume you want the service running on port 8080 as default http service.



# Please note to remove ="" notations from config file. Its shows due to code-highlight error. Check lines 5 and 13.
# Eg : in the < VirtualHost *:80=""> syntax ="" should be removed


ServerAdmin admin@example.com
ServerName example.com
# DocumentRoot /home/httpd/
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined


Order deny,allow
Allow from all
#Allow from .your_domain.com

ProxyRequests Off
ProxyPreserveHost On

ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/





for expose service running on 8083 as a https connection


# Please note to remove ="" notations from your config file. Its shows due to code-highlight error. check lines 4 and 21.
# Eg : in the < VirtualHost *:443=""> syntax ="" should be removed


ServerAdmin admin@example.com
ServerName example.com
#ServerAlias example.com
#DocumentRoot /home/httpd/

ErrorLog /var/log/apache2/ssl-error.log
LogLevel warn
CustomLog /var/log/apache2/ssl-access.log combined
ServerSignature On

SSLEngine On
SSLCertificateFile /etc/apache2/certs/example.crt
SSLCertificateKeyFile /etc/apache2/certs/example.key
SSLCertificateChainFile /etc/apache2/certs/CA.crt

SSLProxyEngine on

Order deny,allow
Allow from all
#Allow from .your_domain.com


ProxyRequests Off
ProxyPreserveHost On

ProxyPass / https://127.0.0.1:8083/
ProxyPassReverse / https://127.0.0.1:8083/