OCFS2 cluster – quick setup guide



OCFS2 is a POSIX-compliant shared-disk cluster file system for Linux capable of providing both high performance and high availability. Cluster-aware applications can make use of parallel I/O for higher performance. OCFS2 is mostly used to host Oracle Real application clusters (RAC) database on Linux clusters.

The below steps shows how to create ocfs2 filesystem on top a multipath’d SAN lun and mount it on Linux clusters.

1. Identify the nodes that will be part of your cluster.

2. Export/Zone the LUNs on the SAN end and check whether they are accessible on all the hosts of the cluster. (fdisk -l or multipath -ll)

3. If you need multipathing, configure multipath and the multipathing policy based on your requirement. For Linux multipath setup, refer Redhat’s multipath guide.

4. Create OCFS2 configuration file (/etc/ocfs2/cluster.conf) on all the cluster nodes.

How to Take Ownership of a File, Folder Using Command-line in Window 7 and Vista

Taking ownership of a file

Click Start, click All Programs, click Accessories, right-clickCommand Prompt, and then click Run as Administrator.
Type the following command and press ENTER:  TAKEOWN /F<filename>
(Replace the text <filename> with the full path of the actual file.)
If the operation was successful, you should see the following message:
“SUCCESS: The file (or folder): “filename” now owned by user “Computer Name\User name“.”
Then to assign the Administrators group Full Control Permissions for the file, you may use the ICACLS command.
Use this syntax:  ICACLS <filename> /grant administrators:F

Cài đặt thêm extension openssl vào PHP

Tải bản PHP tương ứng với bản đang chạy về server, giải nén
cd {php_dir (vừa giải nén)}/ext/openssl 
Chạy phpize (lưu ý phải chạy đúng với phiên bản php đang chạy trong trường hợp cài nhiều bản php trên server) Ví dụ:  sudo /u01/app/httpd2/php/bin/phpize
./configure –with-php-config=/u01/app/httpd2/php/bin/php-config
make
make install
Lưu ý: 
- Có thể file {php_dir (vừa giải nén)}/ext/openssl/config.m4  không tồn tại hoặc bị sai tên –> tìm file khác hoặc đổi lại tên là được.


Custom symfony error pages for 404 and 500 errors

500 error page
- Since symfony 1.2 your error page must be stored as error.html.php in the folder /config/errors/
- Default file:/lib/vendor/symfony/lib/exception/data/error.html.php
Available variables:  (một số biến được dùng trong file error)
- $exception: The exception.
- $code: The status code. Defaults to 500 but might have been replaced by $response->getStatusCode().
- $text: The status text. Defaults to “Internal server error” but might have been replaced by $response->getStatusText().
- $format: The request format. Defaults to “html” but might have been replaced by $response->getRequestFormat().

symfony execute raw query with doctrine

$query = ‘INSERT INTO table_name (`field1`, `field2 `, `content`, `created_at`) values ‘ ….

$conn = Doctrine_Manager::connection();
$pdo = $conn->execute($query);

Enable logging in the Symfony production environment

To enable symfony logging edit the file apps/frontend/config/settings.yml
prod:
  .settings:
    logging_enabled:        on
edit apps/frontend/config/factories.yml
prod:
  logger:
    class: sfAggregateLogger
    param:
      level: debug

DoubleClick in IE

The normal sequence of events fired leading up to a doubleclick go as follows.
    • mousedown
    • mouseup
    • click
    • mousedown
    • mouseup
    • click
    • doubleclick
but in IE, if you doubleclick on a link, and image or any element, the events fired are:
    • mousedown
    • mouseup
    • click
    • mousedown
    • mouseup
    • click
    • doubleclick
Thats right, no second mousedown?, and no second click!
As a developer, if you are tracking mousedown, mouseup, and click events… you need to be aware of this because if your users doubleclick by accident any actions that are designed to “stop” onmouseup might try and reference something that wasn’t started… and if the onclick was being used to quit listening for example… that event may never fire.

How to configure HTTPS on Apache 2

Configure HTTPS on Apache 2
1. Create httpd.pem & httpd.key file
# mkdir /data/www/project/ssl/
# openssl req -new -x509 -days 365 -nodes -out /data/www/project/ssl/httpd.pem -keyout /data/www/project/ssl/httpd.key

fix unknown table engine innodb

Hệ thống đang hoạt động bình thường. Nếu xảy ra lỗi “unknown table engine ‘innodb’ ”. Xử lý như sau:
1. Kiểm tra innodb có hoạt động không?
mysql> SHOW VARIABLES LIKE 'have_innodb';
   +---------------+-------+
   | Variable_name | Value |
   +---------------+-------+
   | have_innodb   | NO   |
   +---------------+-------+
--> disabled.

How To Create an IE-Only Stylesheet

Target ALL VERSIONS of IE

<!--[if IE]>
               <link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->

Target everything EXCEPT IE

<!--[if !IE]><!-->
               <link rel="stylesheet" type="text/css" href="not-ie.css" />
 <!--<![endif]-->

Run Crontab Every 5 Minutes, 10 minutes, Seconds, Hours, Days, Months

1. Execute a cron job every 5 Minutes
The first field is for Minutes. If you specify * in this field, it runs every minutes. If you specify */5 in the 1st field, it runs every 5 minutes as shown below.
*/5 * * * * /home/test/test.sh
In the same way, use */10 for every 10 minutes, */15 for every 15 minutes, */30 for every 30 minutes, etc.
2. Execute a cron job every 5 Hours
The second field is for hours. If you specify * in this field, it runs every hour. If you specify */5 in the 2nd field, it runs every 5 hours as shown below.
0 */5 * * * /home/test/test.sh
In the same way, use */2 for every 2 hours, */3 for every 3 hours, */4 for every 4 hours, etc.

Thống kê các bảng có dữ liệu lớn trong mysql


Thống kê các bảng có dữ liệu lớn trong mysql

Rất hữu ích khi cần thống kê để đánh partion.

SELECT table_name, table_rows, data_length, index_length, round(((data_length + index_length) / 1024 / 1024 / 1024 ),4) as `Size(G)` FROM information_schema.TABLES WHERE table_schema = 'your_db_name' ORDER BY DATA_LENGTH DESC;