Pages

Bài đăng phổ biến

Tuesday, November 6, 2012

[Solved] : Error: database disk image is malformed

When you run yum update it return this error:

Error: database disk image is malformed

Fixed: 

you just run this cmd yum clean dbcache 
or    yum clean all 
Done !

Nguyen Si Nhan

Thursday, October 25, 2012

Fixed : Need at least one XML library, --with-expat is supported


Error when compiled:

      configure: error: Need at least one XML library, --with-expat is supported
fixed:

   yum install expat expat-devel

then you rerun ./configure,that's all

Nguyen Si Nhan

Tuesday, October 23, 2012

Fixed : Error 1722: The RPC server is unavailable

Can not start service: Windows Audio Endpoint Builder
:

Services
---------------------------
Windows could not start the Windows Audio Endpoint Builder service on Local Computer.


Error 1722: The RPC server is unavailable.

---------------------------
OK
---------------------------

Fixed: Enable Power service is solved the problem 

Nguyen Si Nhan

Thursday, October 18, 2012

Monitor hardisk on dell server with small bash script


This is a my small scirpt (run it as cron),it will send to zabbix status Ok or Fail of your physical disk on Dell server :

Dell.sh

#!/bin/bash
#Writed by nhanns[@]vng[dot]com[dot]vn -nhannguyen[@]0937686468[dot]com
#skype: nguyen_si_nhan
#Program'll send alert status to zabbix

#Check number controller
[ ! -f "/opt/dell/srvadmin/bin/omreport" ] && { echo "omreport:file not found-please install hardware monitor for Dell"; exit 1; }
Controller=0
/opt/dell/srvadmin/bin/omreport storage controller >/tmp/controller.tmp
_file1="/tmp/controller.tmp"
#check empty file
if [ ! -s "$_file1" ]
then
echo "Can not run on this server"
exit 2
fi
while read line; do
    Bool=0
    if [[ "$line" = ID* ]]; then
        Bool=1
        (( Controller++ ))
        # do something with  ?
    fi
done < /tmp/controller.tmp

#Export to file status of physical disk
i=0
rm -f /tmp/dellstatus.log;
while (( i < Controller )) ; do
/opt/dell/srvadmin/bin/omreport storage pdisk controller=$i >> /tmp/dellstatus.log
  (( ++i ))
done

_file2="/tmp/dellstatus.log"
if [ ! -s "$_file2" ]
then
echo "Can not run on this server"
exit 3
fi

Failstatus=0
statusOK=0
while read line; do
    BoolSt=0
BoolOk=0
   if [[ "$line" = Status* ]]; then
        BoolSt=1
       (( Failstatus++ ))
       # do something with ... ?
   fi
  if [[ "$line" = *Ok* ]]; then
        BoolOk=1
       (( statusOk++ ))
       # do something with  ...?
      fi
          if [[ "$line" = *Non-Critical* ]]; then
                BoolOk=1
                (( statusOk++ ))
                # do something with  ...?
           fi


done < /tmp/dellstatus.log
#echo "There were Failstatus $Failstatus Status ."

#echo "There were  statusOk $statusOk Ok ."

# Problem = ` $Failstatus - $statusOk `
#let Problem=$Failstatus - $statusOk
#echo 'There are'
#echo `expr  $Failstatus - $statusOk `
/opt/zabbix/bin/zabbix_sender -c /opt/check.conf -k hddstatus -o `expr  $Failstatus - $statusOk`

Saturday, October 6, 2012

Solved Linux extended iostat template problem


Problem:
+ Running data query [11].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/iostat.xml'
+ XML file parsed ok.
+ Invalid field <index_order>ioDescr:ioName:ioIndex</index_order>
+ Must contain <direction>input</direction> fields only

Solved:
Edit file <path_cacti>/resource/snmp_queries/iostat.xml

<interface>
        <name>Get IOSTAT Devices</name>
        <description>Queries a host for a list of monitorable devices from iostat</description>
        <oid_index>.1.3.6.1.3.1</oid_index>
        <index_order>ioDescr:ioName:ioIndex</index_order>
Change this line: <index_order>ioDescr:ioName:ioIndex</index_order>
to : <index_order>ioDescr:ioIndex</index_order>
Done
Nguyen Si Nhan

Tuesday, September 18, 2012

Directadmin : Restore httpd.conf custom

echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue

That's all.

Nguyen Si Nhan

Sunday, August 12, 2012

Fixed : Premature end of script headers: graphite.wsgi

If you see this error ,you should disable mod_python after that restart httpd.
This problem usually happen when you use mod_python and mod_wsgi same time.

Nguyen Si Nhan

Monday, August 6, 2012

IndentationError: unexpected indent

message =  '\n'.join(lines) + '\n'
error:
IndentationError: unexpected indent
fix:
message ='\n'.join(lines) + '\n'
delete blank beforce '\n'.

Nguyen Si Nhan


Monday, July 16, 2012

How to change the listening port for Remote Desktop


  1. Start Registry Editor.
  2. Locate and then click the following registry subkey:
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber
  3. On the Edit menu, click Modify, and then click Decimal.
  4. Type the new port number, and then click OK.
  5. Quit Registry Editor.
  6. Restart the computer.

Friday, July 13, 2012

[Fixed] main option local_delivery unknown

add this line to before local_delivery:
localuser: 
driver = accept check_local_user
# local_part_suffix = +* : -*
# local_part_suffix_optional  
transport = local_delivery


Nguyễn Sĩ Nhàn

Thursday, July 12, 2012

[Fixed] Sqlite error unable to open database file

When you meet this problem that is your director contain file database still chmod own or chmod correct, process fast you only just chmod 777 this dir or chown to user that own by databases file.

Nguyen Si Nhan

Wednesday, June 6, 2012

Set Timezone by cmd on Centos ( linux)

# ln -sf /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/locatime
`
Write the current System Time to the Hardware Clock
# hwclock —systohc





Nguyen Si nhan

[Solved] No package scp available

fix: yum install openssh-clients

[Solved] virNetServerMDNSStart:460 : internal error Failed to create mDNS client: Daemon not running

Fix:


Further investigation found avahi was needed for this to work. The final fix was running
yum -y install avahi
/etc/init.d/messagebus restart
/etc/init.d/avahi-daemon restart
/etc/init.d/libvirtd restart
/sbin/chkconfig messagebus on
/sbin/chkconfig avahi-daemon on
Source: http://quags.net/archives/53

Friday, May 25, 2012

Create Repo Centos via Iso

#mount -o loop /path/file.iso /mnt
#vi /etc/yum.repos.d/rhel6.repo
[rhel]
name=rhel6
baseurl=file:///mnt
enabled=1
gpgcheck=0

Nguyễn Sĩ Nhàn

[Solved] x.x.x.x Sorry, the domain is already pointed to an IP address .....

Problem: Using nameservers with the following IPs: x.x.x.x Sorry, the domain is already pointed to an IP address that does not appear to use DNS servers associated with this server. Please transfer the domain to this servers nameservers or have your administrator add one of its nameservers to /etc/ips.remotedns and make the proper A entries on that remote nameserver.

Solution:  Tweaksetting -> Allow Remote Domains -> On .

Done

Nguyen Si Nhan

Tuesday, May 22, 2012

Sunday, May 20, 2012

Failed to initialize remote display subsystem

You just create a new   user with name __vmware_user__ is all ok:
 net user  __vmware_user__ /add


Nguyen Si Nhan 

Monday, May 14, 2012

[Solved] Trouble shoot kvm virsh hang

Problem: When you type virsh list or virsh ... it's not return anything such as it's hanging

Solution: You just remove libvirtd and install it again ,Problem will be solved.

Nguyen Si Nhan

Tuesday, May 8, 2012

[Solved] libvirtError: Unable to read from monitor: Connection reset by peer

Problem :
Error starting domain: Unable to read from monitor: Connection reset by peer

Solution:

 virsh edit <domainname>

Search these word:  <graphics type='vnc' port='-1' autoport='yes'/>
Delete it and save .

After that start vm again is ok.
Good luck :) !

Nguyen Si Nhan




Deny all IP access to port assigned exclude my IP


In my exaple is port 25 and my ip is 1.2.3.4:


iptables -A INPUT -p tcp --dport 25 -s 1.2.3.4 -j ACCEPT
iptables -A INPUT -p tcp --dport 25 -s 1.2.3.4 -j ACCEPT
iptables -A INPUT -p tcp --dport 25 -j DROP

Finish!

Nguyen Si Nhan

Thursday, May 3, 2012

Run a program background on Linux

You just type more > /dev/null & :


ie: ls > /dev/null &


Nguyễn Sĩ Nhàn

Timezone with graphite

You just edit file wepapp/graphite/setting.py change line(or uncomment ),in my case i change such as:

TIME_ZONE = 'Asia/Ho_Chi_Minh'

Nguyen Si Nhan

Friday, April 27, 2012

Sunday, April 8, 2012

Change time zone on Linux

ln -sf /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime
type date to confirm that date changed
NSN

Wednesday, March 28, 2012

Send mail via telnet

1. Telnet to hostname on port 25
2. HELO your_domain_name or whatever
3. MAIL FROM:[email protected] (ie, your email address)
4. RCPT TO:them@someplace_else.com (email address you want to send to)
5. DATA
6. You type your message then CRLF period CRLF (ie, type a period on a line by itself then hit ENTER)
7. QUIT
NSN

Tuesday, March 27, 2012

Monday, March 26, 2012

Bán Galaxy tab 10.1 đang dùng còn bảo hành tới tháng 12 năm 2012

Hi all,

-Mình đang cần tiền bán Galxytab 10.1 đang dùng rất tốt còn bảo hành tới tháng 12 năm 2012 ,giá fixed 9tr500 ai mua liên hệ mình qua số : 0937686468 ,Nguyễn Sĩ Nhàn .

Đây là video về em nó:
http://www.youtube.com/watch?v=vdu5PVjCGo0

Thật sự là bán rất tiếc nhưng kẹt quá nên phải cho em nó đi thôi :) .

Đã bán.


Monday, March 19, 2012

How Do I Enable Remote Access To MySQL Database Server?


How Do I Enable Remote Access To MySQL Database Server?

By default remote access to MySQL database server is disabled for security reasons. However, some time you need to provide remote access to database server from home or a web server. If you want to remotely access to the database server from the web server or home, follow this quick tutorial.

MySQL Remote Access

You need type the following commands which will allow remote connections.

Step # 1: Login Using SSH (if server is outside your data center)

First, login over ssh to remote MySQL database server:
ssh [email protected]

Step # 2: Edit my.cnf File

Once connected you need to edit the MySQL server configuration file my.cnf using a text editor such as vi.
  • If you are using Debian Linux file is located at /etc/mysql/my.cnf location
  • If you are using Red Hat Linux/Fedora/Centos Linux file is located at /etc/my.cnf location
  • If you are using FreeBSD you need to create a file /var/db/mysql/my.cnf
Edit /etc/my.cnf, run:
# vi /etc/my.cnf

Step # 3: Once file opened, locate line that read as follows

[mysqld] 
Make sure line skip-networking is commented (or remove line) and add following line
bind-address=YOUR-SERVER-IP
For example, if your MySQL server IP is 65.55.55.2 then entire block should be look like as follows:
[mysqld]
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
language        = /usr/share/mysql/English
bind-address    = 65.55.55.2
# skip-networking
....
..
....
Where,
  • bind-address : IP address to bind to.
  • skip-networking : Don’t listen for TCP/IP connections at all. All interaction with mysqld must be made via Unix sockets. This option is highly recommended for systems where only local requests are allowed. Since you need to allow remote connection this line should be removed from my.cnf or put it in comment state.

Step# 4 Save and Close the file

Restart the mysql server, enter:
# /etc/init.d/mysql restart

Step # 5 Grant access to remote IP address

Connect to mysql server:
$ mysql -u root -p mysql

Grant access to a new database

If you want to add a new database called foo for user bar and remote IP 202.54.10.20 then you need to type the following commands at mysql> prompt:mysql> CREATE DATABASE foo;
mysql> GRANT ALL ON foo.* TO bar@'202.54.10.20' IDENTIFIED BY 'PASSWORD';

How Do I Grant Access To An Existing Database?

Let us assume that you are always making connection from remote IP called 202.54.10.20 for database called webdb for user webadmin, To grant access to this IP address type the following command At mysql> prompt for existing database, enter:
mysql> update db set Host='202.54.10.20' where Db='webdb';
mysql> update user set Host='202.54.10.20' where user='webadmin';

Step # 5: Logout of MySQL

Type exit command to logout mysql:mysql> exit

Step # 6: Open port 3306

You need to open TCP port 3306 using iptables or BSD pf firewall.

A sample iptables rule to open Linux iptables firewall

/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
OR only allow remote connection from your web server located at 10.5.1.3:
/sbin/iptables -A INPUT -i eth0 -s 10.5.1.3 -p tcp --destination-port 3306 -j ACCEPT
OR only allow remote connection from your lan subnet 192.168.1.0/24:
/sbin/iptables -A INPUT -i eth0 -s 192.168.1.0/24 -p tcp --destination-port 3306 -j ACCEPT
Finally save all rules:
# service iptables save

A sample FreeBSD / OpenBSD pf rule ( /etc/pf.conf)

pass in on $ext_if proto tcp from any to any port 3306
OR allow only access from your web server located at 10.5.1.3:
pass in on $ext_if proto tcp from 10.5.1.3 to any port 3306  flags S/SA synproxy state

Source: cyberciti


Bonus: Enable mysql remote for user root:
mysql> update user set host='%' where user='root';
Nguyen Sĩ Nhàn

Friday, March 9, 2012

Tuesday, March 6, 2012

Changing the Asterisk manager password


If you are using the default password, you will see the message:

Warning: You are running FreePBX and Asterisk with the default manager pass. You should consider changing this to something else.
Running with the default password is a bad idea, simply because everyone else in the world knows it, and (if not properly firewalled, etc etc) could potentially connect to your asterisk box and do bad things(tm).
Warning: Don't get cute and try to use a password with non-alphabetic or non-numeric characters - things may break in strange ways if you try to use punctuation characters in passwords. Unless you really know what you are doing, stick to numbers and standard alphabetic characters. Also, you should probably read the comments below, to understand the importance of making a full backup before changing anything in case something goes wrong.

Changing the password

To do this, you need to edit two files: /etc/asterisk/manager.conf and /etc/amportal.conf

manager.conf

This controls the asterisk 'manager' users that are allowed to connect to the asterisk manager interface.
You can have as many users in here as you'd like (for example, an operator panel might use one) and in fact, you should have different users for each application.
FreePBX requires a user that has a definition like the following:
[admin]
secret = secret123password
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user

amportal.conf

There needs to be a corresponding entry in /etc/amportal.conf
AMPMGRUSER=admin
AMPMGRPASS=secret123password


Obviously you just need to use the same username (inside the square brackets) and password as above.
Once you have made the changes, you need to click on "Apply Configuration Changes" in order for the change to propagate throughout the system (If you don't see the orange "Apply Configuration Changes" bar, go to one of the GUI screens in the system and re-submit the page, no changes necessary). If you don't do this, then extensions_additional.conf will have stale data resulting in a broken phone system.

Source: .freepbx.org

Monday, March 5, 2012

Bộ gõ tiếng Việt Unikey bị chèn mã độc


Sau khi chiếm quyền kiểm soát trang Unikey.org, tin tặc trỏ các đường dẫn download phần mềm về một website giả mạo và những file tải Unikey trên trang này đều chứa Trojan độc hại.

Phát hiện trên bắt đầu gây xôn xao trên các diễn đàn bảo mật từ ngày 1/3. Trojan này, được công ty bảo mật CMC InfoSec gọi là gọi là FakeUnikey.1, sẽ cài đặt dịch vụ vào máy người dùng rồi tải thêm các mã độc khác và biến hệ thống bị lây nhiễm trở thành máy tính ma dưới sự kiểm soát của hacker.
Sau 24 giờ nhận được thông báo, CMC InfoSec đã phát hành công cụ loại trừ mã độc (cập nhật vào cơ sở dữ liệu của CMC Anvirus/CMC Internet Security). Công ty này nhận định "malware đã được đưa lên mạng từ 23/1 hoặc có thể là trước đó, do đó số lượng người dùng bị lừa tải phần mềm Unikey chứa mã độc là rất lớn".
Ông Phạm Kim Long, tác giả công cụ Unikey, cho biết thêm một trang web khác là unikey.vn/vietnam cũng là giả mạo. Để đảm bảo chương trình sạch, mọi người chỉ download bộ cài Unikey từ địa chỉ sf.net/projects/unikey.

Link tải công cụ diệt malware stl trong unikey:

http://www3.cmcinfosec.com/downloads/tools/CMC.CleanFakeUnikey.zip

Thông tin thêm thông thường mọi người nghĩ trojan là cái gì đó độc hại mà anti virus mới cập nhật có thể scan thấy tuy nhiên việc chèn code downloader ( ko làm gì cả chỉ làm nhiệm vụ download và thực thi file từ 1 hay nhiều link chỉ định) rất khó khăn cho anti-virus phát hiện.

Tuesday, February 21, 2012

500 - Internal Server Error plesk

If you have problem when you access plesk via https://ip:8443 you try to restart service of plesk:

/etc/init.d/sw-cp-server restart

NSN

Fixed: Call-time pass-by-reference error and possible solution

-If your code return this error: Call-time pass-by-reference error and possible solution :

edit php.ini search this line: allow_call_time_pass_reference equal On (usually you will see equal off) .
NSN

File content mysql root and password of ISPconfig

/home/admispconfig/ispconfig/lib/config.inc.php

NSN

Sunday, February 12, 2012

Saturday, February 11, 2012

fdisk vs mkfs.ext3



This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

NSN

Thursday, February 2, 2012

Cpanel : Backup and restore multi website by script

Backup:

Create a file with name backup.sh


for i in $(ls /var/cpanel/users)
do /scripts/pkgacct $i
done
Restore:

Create a file with name restore.sh:

for x in $(ls cpmove-*.tar.gz | cut -d "." -f 1); do /scripts/restorepkg $x; done

or

#!/bin/bash
for i in $(cat /backup/restore.txt)
do /scripts/restorepkg $i
done

With restore.txt is list username and file backup is in /home dir


or



#!/bin/bash
for x in $(ls /home/backup-*.tar.gz | cut -d "_" -f 3 | cut -d "." -f 1);
do   /scripts/restorepkg $x;
done
echo "Written by Nguyen Si Nhan"


Nguyễn Sĩ Nhàn

Tuesday, January 31, 2012

Unknown SQL engine


Problem:After installing the FreePBX,admin page show  the following message:

FATAL ERROR
Unknown SQL engine: []
Trace Back
/var/www/html/admin/common/db_connect.php:57 die_freepbx()
[0]: Unknown SQL engine: []
/var/www/html/admin/bootstrap.php:75 require_once()
[0]: /var/www/html/admin/common/db_connect.php
/var/www/html/admin/config.php:61 require()
[0]: /var/www/html/admin/bootstrap.php



Solution:vim +231 /etc/httpd/conf/httpd.confchange User apache and Group apache to User asterisk and Group asterisk.
vim +327 /etc/httpd/conf/httpd.confchange None to All.
or use sed to replace.
sed -i '231,232s/apache/asterisk/i;327s/none/All/i' /etc/httpd/conf/httpd.confRestart apache service.
service httpd restart
================================================================
 

[solved] configure: *** XML documentation will not be available because the 'libxml2' development package is missing.

yum install install libxml2-devel
Nguyen Si Nhan

[solved] configure: error: *** termcap support not found (on modern systems, this typically means the ncurses development package is missing),

# yum install ncurses-devel
Nguyen Si Nhan 

[solved] error: C++ preprocessor /lib/cpp fails sanity check

you just run this cmd:
# yum install gcc-c++
Nguyen Si Nhan

Monday, January 30, 2012

[solved] You do not appear to have the sources for the 2.6.18-274.17.1.el5 kernel installed.


When installing asterisk and the zaptel or dahdi module, you may reach the error:
You do not appear to have the sources for <your-kernel-version>
Here, I will explain exactly what asterisk is looking for and how you can fix it.
First, you may really need to install the kernel sources. The headers are needed to compile zaptel/dahdi.
If you use yum, you can install from repository.
yum -y install kernel-devel
If you run SMP kernel, use instead
yum -y install kernel-smp-devel
Here is what zaptel/dahdi will do to determine if you have the kernel source or not :
- find your kernel version by running uname -r and stock it into $(KVERS)
- set variable $(KSRC) to one of the following /lib/modules/$(KVERS)/build or /usr/src/linux or /usr/src/linux-2.4. The Makefile will then check if one of those directories exist.
- The $(KSRC) directory should contain the .config file.
If you installed the kernel sources, you should have the .config file somewhere in /usr/src/kernels/(somedir)
You just then have to create a symbolic link from /usr/src/linux or /lib/modules/$(KVERS)/build to that directory.
Reconfigure, recompile zaptel/dahdi and asterisk.
Hope it helps

From http://www.astblog.com

Set password for mysql

mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword


Nguyen Si Nhan

[Solved] PEAR must be installed


You just install php-pear-DB and php-mysql is Ok.
# yum install php-pear-DB
# yum install php-mysql


Nguyen Si Nhan

Thursday, January 19, 2012

Optimize mysql


# Example MySQL config file for very large systems.
#
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
max_connections=500
max_user_connections=70
key_buffer = 384M
max_allowed_packet = 16M
table_cache = 1024
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 128
query_cache_limit=8M
query_cache_size = 256M
query_cache_type = 1
wait_timeout=30
connect_timeout=30
interactive_timeout=30
record_buffer=1M
join_buffer_size=1M
myisam_sort_buffer_size=64M
log-error=/var/log/mysqld.log

#query_cache_limit=2M
local-infile=0
#bind-address = 127.0.0.1
max_connect_errors=60
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking

# Replication Master Server (default)
# binary logging is required for replication

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =   <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port     =  <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin

# Point the following paths to different dedicated disks
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 384M
#bdb_max_lock = 100000

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql/
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql/
#innodb_log_arch_dir = /var/lib/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 384M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 100M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 16M
write_buffer = 16M

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 16M
write_buffer = 16M

[mysqlhotcopy]
interactive-timeout





Wednesday, January 18, 2012

Installing Memcache on CentOS


1

  • Check to make sure that you are running a recent version of CentOS by entering "cat /etc/redhat-release." As of June 2011, the most recent version of CentOS is version 5.6.
  • 2
    Download and setup your system and Memcache to be installed on your server by entering the following commands:
    "cd /user/local/src"
    "curl -O http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz"
    "tar xzvf memcached-1.4.5.tar.gz"
    "cd memcached-1.4.5"
    "LDFLAGS='-W1, --rpath /usr/local/lib' ./configure --prefix=/usr/local"
    These commands move the src directory on your system, download Memcache and set the flags that are required to make Memcache work properly on your system.
  • 3
    Run a simple make install to complete the Memcache installation; the code for this is "make && make install." Please note that you will need root privileges to run this command successfully; this is done in CentOS using the "su" command and entering your root password. Be sure that when the process is completed you "su" back your regular user.
  • 4
    Verify that Memcache is installed properly on your system using the following command: "ps auz | grep memcached." If there are no errors printed in your terminal, then everything is fine with your installation. You can stop Memcache with "pkill memcached."
eHow