Task – redirect all requests from old-domain.com to new-domain.com
use nginx, luke! It`s simple.
server_name old-domain.com www.old-domain.com;
rewrite ^/(.*)$ http://new-domain.com/$1 permanent;
}
Task – redirect all requests from old-domain.com to new-domain.com
use nginx, luke! It`s simple.
Task – need to generate routes file for openvpn from list of our networks.
Check, if file different from current route script, replace one and do some action. This task occurs very often.
Code is very simple, so:
Task – Need to add unique ID to each user request. External nginx module such as request ID is very unstable, so I write small perl script to generate UUID and add it to header.
nginx embedded perl is extremely fast, and works very well in high loaded production systems.
Required packages:
/etc/nginx/nginx.conf
Location config:
If you make a project with huge amount of email notification, you MUST control number of 550 reply from mail servers. Because if you skip this step, and continue sending to deleted mail boxes, big mail providers such as gmail.com, mail.ru, mail.ua, etc. will ban you domain at 0.5 – 1% “user unknown” reply.
So mail.log parsing is only solution.
In our project we add bad email addresses to database table (we use postgress)
1. make database replace rule, if email already added, (email is primary key) it is fastest way to prevent errors on INSERT duplicate email addresses.
Read more »
Our previous developer use standard SQL guide to create query for selection “top 50 referrers”
50 rows in set (26.31 sec)
It significantly loads our database;
Rewrite query for using temporary table with distinct referrer:
50 rows in set (2.48 sec)
I feel happy 🙂 🙂 🙂
Our projects repos hosting on github.
How I make backup (clone all repos using cron + github api) probably there is other way how to make backup, but I don`t find this way.
Mysql tuning in action…
Yesterday me, and our development team made some tuning of one old project we have couple of tables with 1-10 million records.
It`s NOT BIGDATA, but application makes huge writes to this table.
Only current date records, but you understand partitioning affects index size.
Table can be partitioned by date field. So how to do it:
Everybody know
Also everybody know that ‘Seconds_Behind_Master’ shows difference in seconds between the slave SQL thread and the slave I/O thread.
Sometime it shows nonsense, and if you build monitoring It is not good practice to use ‘Seconds_Behind_Master’
Example from real life:
If replication becomes stalled due to connectivity problems, Seconds_Behind_Master shows 0 while replica is far away from master, changing timeout values not help. 🙁 i mean:
slave_net_timeout=300
So we implement following monitoring – every 3 second write current timestamp at master.
and check replica delay.
Or You can use percona heartbeat, It do almost the same.
Read more »
We have huge project with a great number of registered users. They receive notification via email, when actions occur. (new comment, gift, some other activity). Project targeting – Russia and former USSR In Russia some free email hosting providers like mail.ru delete user account after 2-3 years of inactivity.
So we have now 2-3000000 users with bad email address.
How to find them and remove from mailing list:
According to RFC 5321 (smtp rfc) in case of wrong email in rcpt to, server should return 550 no such user.
Read more »
I use mc as file manager, and suffer from Ins. key absence at MAC keyboard.
Recent Comments