Friday 14 June 2013

Retrive mysql root login


Retrive_mysql_root_login

Recover mysql root login:
1.
# /etc/init.d/mysql stop
or service mysqld stop
2.
# mysqld_safe --skip-grant-tables &
3. 
# mysql -u root
4.
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
5.
# /etc/init.d/mysql stop
or service mysqld stop
6.
# /etc/init.d/mysql start or service mysqld start
# mysql -u root -p
<enter the new password> 

*) How to change mysql root password:
$ mysqladmin -u root password NEWPASSWORD
to update the password: $ mysqladmin -u root -p'oldpassword' password newpass

example: $ mysqladmin -u root -p'abc' password '123456'
changing the password of the other user:
$ mysqladmin -u <username> -p oldpassword password newpass

Changing MySQL root user password using MySQL sql command
$ mysql -u root -p
mysql> use mysql;
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='user_name';
mysql> flush privileges;
mysql> quit



*) original link from:

http://www.cyberciti.biz/faq/mysql-change-root-password/
http://www.cyberciti.biz/tips/recover-mysql-root-password.html


mysql perfomance_tunning


perfomance_tunning

Do check things on key_buffer_size query_check_size and query_cache_type.

For a 8GB RAM system we can set the following to get few improvements:

to check the current values (at) mysql prompt:
show variables like 'key_buffer_size';
show variables like 'query_cache_size';
show variables like 'query_cache_type';

to update the values:
set global key_buffer_size=3221225472;                         [ 3 GB ]
set global query_cache_size=268435456;                        [256 MB ]
set global query_cache_type=ON;                

Do monitor the memory information such as swap and physical memory after changes and you might like to check the slow query log file to find still the same query is taking long time or not.

Mysql_Notes2


Mysql_Notes

Note: On a System we can have multiple DB [ database ] and the default one is mysql. Let's say along with mysql we have one more database known as "MYDB" and if you need to grant some permission to someone on the "MYDB" then all those credentials stays as "mysql" database. 

The username and password stay at "user" table where as the database information stays at "db" tables.

1. mysql -uroot -p -h localhost
2. show databases;
3. create database world;
4. use world;
5. source /home/amit/world.sql [ download the same database from http://dev.mysql.com/doc/index-other.html -> MyISAM or Innodb]
6. show tables;

NOTE: "$" -> unix console and ">" -> mysql console [ default is mysql console ]

7. Communication protocols: [ protocol - Types of connections - OS ]
7a. TCP/IP - local,remote - All
7b. Unix socket file - local only - Unix only
7b. Shared memory - local only - windows only
7d. Named pipes - local only - windows only 

8. Table names are case sensitivity.

9. Default installation location: /usr/local/mysql [ currently in my system its at: /var/lib/mysql] and the files I can see with in /var/lib/mysql/world: 
a. City.frm
b. City.MYD
c. City.MYI
d. Country.frm
e. Country.MYD
f. Country.MYI
g. CountryLanguage.frm
h. CountryLanguage.MYD
i. CountryLanguage.MYI
j. db.opt

10. Basic commands that must be executed to install  a MySQL source distribution:
shell> groupadd mysql 
shell> useradd -g mysql mysql 
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf - 
shell> cd mysql-VERSION 
shell> ./configure --prefix=/usr/local/mysql 
shell> make 
shell> make install 
shell> cp support-files/my-medium.cnf /etc/my.cnf 
shell> cd /usr/local/mysql 
shell> chown -R mysql . 
shell> chgrp -R mysql . 
shell> scripts/mysql_install_db --user=mysql 
shell> chown -R root . 
shell> chown -R mysql var 
shell> bin/mysqld_safe --user=mysql &

11. mysql> select @@global.time_zone, @@session.time_zone;  [ to know the current values of the global and client-specific time zones ]


12. mysql -uroot -p
13. use mysql
14. show tables like 'time_zone%' [ show the system tables that have somethings to do with time zones ]

mysql> show tables like 'time_zone%';
+------------------------------+
| Tables_in_mysql (time_zone%) |
+------------------------------+
| time_zone                    | 
| time_zone_leap_second        | 
| time_zone_name               | 
| time_zone_transition         | 
| time_zone_transition_type    | 
+------------------------------+
5 rows in set (0.00 sec)

15. describe time_zone\G [ display the design of the tabl time_zone ] -> this specific listing shows that there are two columns in the "time_zone" table with the details of what each column stores and how it stores it.

mysql> describe time_zone\G;
*************************** 1. row ***************************
  Field: Time_zone_id
   Type: int(10) unsigned
   Null: NO
    Key: PRI
Default: NULL
  Extra: auto_increment
*************************** 2. row ***************************
  Field: Use_leap_seconds
   Type: enum('Y','N')
   Null: NO
    Key: 
Default: N
  Extra: 
2 rows in set (0.00 sec)


16. select * from time_zone; [ display the contents of the time_zone ]

17. Different method of starting mysql server on linux:

a. mysqld: Invoke manually for debugging.
b. mysqld_safe: launches, monitors and restarts mysqld if needed.
c. mysql.server: wrapper for mysqld_safe for O/S's using system V
d. mysqld_multy: perl script for managing myltiple servers.

18. On linux: to start and stop: 

a. /etc/rc.d/init.d/mysql start
b. /etc/rc.d/init.d/mysql stop

19. If the server does not start properly, look in the error log. The default error log name on Linux is host_name.err in the data directory, where host_name is the name of the server host.

20. Method and Descriptions:
a. mysqladmin: Connects to server as client to shutdown server local or remote.
b. mysql.server: Will stop and/or shutdown the local server
c. mysqld_multi: Invokes mysqladmin to stop and/or shutdown servers it manages.

21. mysqlcheck --check-upgrade --all-databases --auto-repair mysql_fix_privilege_tables [ To check and repair tables and to upgrade the system tables ]
22. help <mysql_command> [ to get help on the mysql_command ]
23. mysql_upgrade --help

24. $mysql --help;

25. Few and/or default mysql server configuration:

[on windows]
a. basedir:
b. datadir:
c. shared-memory
d. enable-named-pipe
e. general_log
f. log-bin
g. slow_query_log=[1|0] -> [ 1=enable, 0=disable]
h. default-storage-engine=InnoDB
i. max_connections=200
j. key_buffer_size=128M
k. slow_query_log_file

26. $my_print_defaults [ display the options that are present in option group of the option files]
27. $mysql --print-defaults [ the same option file information can also be listed from the command ]

28. show variables like 'bulk%';
29. set global
30. set session
31. set bulk_insert_buffer_size=4100000;

32. show global status; [ display the status values for all connections to mysql]
33. show status [ provides server status information ]
34. show session status; [ display the status values for the current connection]

35. sql-mode=IGNORE_SPACE [ Setting the SQL mode ]
36. set [session|global] sql_mode='mode_value'
37. select @@sql_mode; [ to check the current sql_mode settings ] 
38. set sql_mode='TRADITIONAL'; [ to set sql_mode to traditional ]

39. SQL MODE Values:
a. ANSI_QUOTES: This mode causes the double quote character (‘"’) to be interpreted as an identifier- quoting character rather than as a string-quoting character.

b. IGNORE_SPACE: By default, functions must be written with no space between the function name and the following parenthesis. Enabling this mode causes the server to ignore spaces after function names. This allows spaces to appear between the name and the parenthesis, but also causes function names to be reserved words.

c. ERROR_FOR_DIVISION_BY_ZERO: By default, division by zero produces a result of NULL and is not treated specially. Enabling this mode causes division by zero in the context of inserting data into tables to produce a warning, or an error in strict mode.

d. STRICT_TRANS_TABLES, STRICT_ALL_TABLES: These values enable "strict mode", which imposes certain restrictions on what values are acceptable as database input. By default, MySQL is forgiving about accepting values that are missing, out of range, or malformed. Enabling strict mode causes bad values to be treated as erroneous. STRICT_TRANS_TABLES enables strict mode for transactional tables, and STRICT_ALL_TABLES enables strict mode for all tables.

e. TRADITIONAL: Enables strict modes plus several restrictions on acceptance of input data. Enforces restrictions on input data values that are like other database servers, rather than MySQL's more forgiving behavior. Allows user accounts to be created only with the GRANT statement when a password is specified

f. ANSI: This is a composite mode that causes MySQL server to be more "ANSI-like". That is, it enables behaviors that are more like standard SQL, such as ANSI_QUOTES (described earlier) and PIPES_AS_CONCAT, which causes || to be treated as the string concatenation operator rather than logical OR.

command mysqldumpslow


mysqldumpslow

syntax: 
mysqldumpslow <mysql_slow_log_file>

mysqldumpslow -s at <mysql_slow_log_file>

Count: 438  Time=5.80s (2540s)  Lock=0.00s (0s)  Rows=4331.9 (1897393), moviesfe[moviesfe]@4hosts

Notes on mysqldumpslow:
NOTE: -s t [ t for count => sort on hight count of a same query ]
NOTE: -s at [ at for time => sort on hight time take query ]
NOTE: -s l [ sort bashed on the query those lock the table ]
NOTE: -s al [ Sort on lock and large query size -> do a recheck, might be large query size ]
NOTE: -s r [ bashw=ed on row]

is in order:
t=count, at=time, l=lock, al=rows, r=

$mysqldumpslow --help
Usage: mysqldumpslow [ OPTS... ] [ LOGS... ]

Parse and summarize the MySQL slow query log. Options are

  --verbose    verbose
  --debug      debug
  --help       write this text to standard output

  -v           verbose
  -d           debug
  -s ORDER     what to sort by (t, at, l, al, r, ar etc), 'at' is default
  -r           reverse the sort order (largest last instead of first)
  -t NUM       just show the top n queries
  -a           don't abstract all numbers to N and strings to 'S'
  -n NUM       abstract numbers with at least n digits within names
  -g PATTERN   grep: only consider stmts that include this string
  -h HOSTNAME  hostname of db server for *-slow.log filename (can be wildcard),
               default is '*', i.e. match all
  -i NAME      name of server instance (if using mysql.server startup script)
  -l           don't subtract lock time from total time

command mysqlbinlog

mysqlbinlog

1. --start-datetime and --stopdatetime syntax:

 mysqlbinlog --start-datetime="11/09/06 04:00" --stop-datetime="11/09/06 05:00" <binfile_name> 

Following command also works:

 mysqlbinlog <binfile_name> --start-datetime="11/09/06 04:00" --stop-datetime="11/09/06 05:00"

 mysqlbinlog -d <dbname> <binfile_name> 


mysqlbinlog -help
mysqlbinlog Ver 3.0 for unknown-linux-gnu at x86_64
By Monty and Sasha, for your professional use
This software comes with NO WARRANTY:  This is free software,
and you are welcome to modify and redistribute it under the GPL license

Dumps a MySQL binary log in a format usable for viewing or for piping to
the mysql command line client

Usage: mysqlbinlog [options] log-files
  -d, --database=name List entries for just this database (local log only).
  -D, --disable-log-bin 
                      Disable binary log. This is useful, if you enabled
                      --to-last-log and are sending the output to the same
                      MySQL server. This way you could avoid an endless loop.
                      You would also like to use it when restoring after a
                      crash to avoid duplication of the statements you already
                      have. NOTE: you will need a SUPER privilege to use this
                      option.
  -f, --force-read    Force reading unknown binlog events.
  -?, --help          Display this help and exit.
  -h, --host=name     Get the binlog from server.
  -o, --offset=#      Skip the first N entries.
  -p, --password[=name] 
                      Password to connect to remote server.
  -P, --port=#        Use port to connect to the remote server.
  -j, --position=#    Deprecated. Use --start-position instead.
  --protocol=name     The protocol of connection (tcp,socket,pipe,memory).
  -r, --result-file=name 
                      Direct output to a given file.
  -R, --read-from-remote-server 
                      Read binary logs from a MySQL server
  --open_files_limit=# 
                      Used to reserve file descriptors for usage by this
                      program
  --set-charset=name  Add 'SET NAMES character_set' to the output.
  -s, --short-form    Just show the queries, no extra info.
  -S, --socket=name   Socket file to use for connection.
  --start-datetime=name 
                      Start reading the binlog at first event having a datetime
                      equal or posterior to the argument; the argument must be
                      a date and time in the local time zone, in any format
                      accepted by the MySQL server for DATETIME and TIMESTAMP
                      types, for example: 2004-12-25 11:25:56 (you should
                      probably use quotes for your shell to set it properly).
  --stop-datetime=name 
                      Stop reading the binlog at first event having a datetime
                      equal or posterior to the argument; the argument must be
                      a date and time in the local time zone, in any format
                      accepted by the MySQL server for DATETIME and TIMESTAMP
                      types, for example: 2004-12-25 11:25:56 (you should
                      probably use quotes for your shell to set it properly).
  --start-position=#  Start reading the binlog at position N. Applies to the
                      first binlog passed on the command line.
  --stop-position=#   Stop reading the binlog at position N. Applies to the
                      last binlog passed on the command line.
  -t, --to-last-log   Requires -R. Will not stop at the end of the requested
                      binlog but rather continue printing until the end of the
                      last binlog of the MySQL server. If you send the output
                      to the same MySQL server, that may lead to an endless
                      loop.
  -u, --user=name     Connect to the remote server as username.
  -l, --local-load=name 
                      Prepare local temporary files for LOAD DATA INFILE in the
                      specified directory.
  -V, --version       Print version and exit.

Variables (--variable-name=value)
and boolean options {FALSE|TRUE}  Value (after reading options)
--------------------------------- -----------------------------
database                          (No default value)
disable-log-bin                   FALSE
force-read                        FALSE
host                              elp
offset                            0
port                              3306
position                          4
read-from-remote-server           FALSE
open_files_limit                  64
set-charset                       (No default value)
short-form                        FALSE
socket                            /tmp/mysql.sock
start-datetime                    (No default value)
stop-datetime                     (No default value)
start-position                    4
stop-position                     18446744073709551615
to-last-log                       FALSE
user                              (No default value)
local-load                        (No default value)



mysql simple table creation


Creating a new table with the time value: and then entering value of the current time too:

* create table <table_name>  (TIMESTAMP timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, TRAFFIC int(4), RES_TIME_MS int(5));
* insert into <table_name> value(now(), 17,65);
- From command line updating the value:
* mysql -uroot -p<password> -e "use <database_name>; insert into <table_name> value(now(), 17,65)"
* mysql -uroot -e "insert into <database_name>.<table_name> vaule(now(),17,70)"
* mysql -uroot -e "select * from <database_name>.<table_name>" 

mysql QA2


6) How to create MYSQL new users?
There are many different ways to establish users and privileges in MYSQL. Client and GRANT command assure you about a safe connection. The syntax for establishing new users and privileges is as follows
GRANT privileges ON database.* TO
‘username’@’hostname’ This can be identified by the password. Privileges can be assigned one by one or by specifying all.

7) Explain about the rules which should be followed while assigning a username?
A username has a maximum length of 16 characters. Spaces should be avoided while creating username because they are case sensitive. Hostname will be the computer from which you are going to connect. The best way to specify a username is to connect through a local host.

8) Explain about a security flaw which is present while creating a username?
Naming MYSQL databases has to be very careful because any database starting with the test name can be accessed by every one on the network. Make sure that you don’t start the databases naming with test. It should be used only for experimental purposes only.

9) State some security recommendations while using MYSQL?
Some of the security recommendations which should be followed while using MYSQL are as follows: -
1) Minimal privileges to users in the network.
2) Super and process privileges should be granted minimally.
3) File privileges should be granted minimally to administrators.
4) Validation of data and queries should be thoroughly checked.

10) Explain about database design?
Database design is also called as Data modeling. It is used for long-term management of database. This process is used to store information and to keep data for long term. Creating an efficient structure helps you to channelize information into good channels.

11) Explain about creating database?
CREATE DATABASE command will create you a database with the assigned name by the user. This is an optional statement but when you actually assign a name it checks for similarity and gives error if it encounters one. CREATE DATABASE models help you to create classic models.

12) Explain about primary keys?
MYSQL allows only one primary key. This primary key can be used on multiple tables. There are many rules which should be followed such as it shouldn’t be null and it can never change. Primary key assigned should be unique it cannot be matched with any other keys.

13) Explain about normalization?
Applying specific rules (normal forms) to the database is the primary process. These rules should be applied in the order specified starting with the first normal form. These rules should be adhered by every database they are
1) Each column should have only one value
2) Repeating columns of data cannot be done.

14) State two considerations which can improve the performance of MYSQL?
Two considerations which can improve the performance of MYSQL are as follows: -
1) Fixed length fields take up more space than variable length fields but they are a bit faster.
2) Size of the field should be restricted to the smallest possible value based upon the largest input value.

15) Explain about the time stamp field?
TIMESTAMP filed occurs when an INSERT and UPDATE field occurs when there is no value specified for the field. There are many behaviors for TIMESTAMP field and it depends upon the version of MYSQL.

16) Explain about MyISAM table?
This feature is a default type for tables. This table is not so much considered for transactions because it is not considered as safe but this kind of table is very fast in execution. The maximum key length is 1024 bytes and 64 keys per table. Size of this table entirely depends upon the operating system.

17) Explain about HEAP table?
This type of table is stored in the memory. Speed of execution of this table is very commendable. There are associated disadvantages associated with this table the primary one being loss of stored memory which occurs when there is power failure and can cause the server to run out of memory. Columns with AUTO_INCREMENT, TEXT characteristics and BLOB are not supported. 


Mysql QA1


1. How to log-in to mysql server?
mysql -h<hostname> -u<username> -p [ for the password]

   2. How do you start MySQL on Linux? 
/etc/init.d/mysql start

   3. Explain the difference between mysql and mysqli interfaces in PHP? 
mysql is the object-oriented version of mysql library functions.

   4. What’s the default port for MySQL Server?
 3306

   5. What does tee command do in MySQL? 
tee followed by a filename turns on MySQL logging to a specified file. It can be stopped by command notee.

   6. Can you save your connection settings to a conf file?
Yes, and name it ~/.my.conf. You might want to change the permissions on the file to 600, so that it’s not readable by others.

   7. How do you change a password for an existing user via mysqladmin?
mysqladmin -u root -p password "newpassword"

   8. Use mysqldump to create a copy of the database?
mysqldump -h mysqlhost -u username -p mydatabasename > dbdump.sql

   9. Have you ever used MySQL Administrator and MySQL Query Browser? 
Describe the tasks you accomplished with these tools.

  10. What are some good ideas regarding user security in MySQL? 
There is no user without a password. There is no user without a user name. There is no user whose Host column contains % (which here indicates that the user can log in from anywhere in the network or the Internet). There are as few users as possible (in the ideal case only root) who have unrestricted access.

  11. Explain the difference between MyISAM Static and MyISAM Dynamic.
 In MyISAM static all the fields have fixed width. The Dynamic MyISAM table would include fields such as TEXT, BLOB, etc. to accommodate the data types with various lengths. MyISAM Static would be easier to restore in case of corruption, since even though you might lose some data, you know exactly where to look for the beginning of the next record.

  12. What does myisamchk do?
It compressed the MyISAM tables, which reduces their disk usage.

  13. Explain advantages of InnoDB over MyISAM? 
Row-level locking, transactions, foreign key constraints and crash recovery.

  14. Explain advantages of MyISAM over InnoDB?
Much more conservative approach to disk space management - each MyISAM table is stored in a separate file, which could be compressed then with myisamchk if needed. With InnoDB the tables are stored in tablespace, and not much further optimization is possible. All data except for TEXT and BLOB can occupy 8,000 bytes at most. No full text indexing is available for InnoDB. TRhe COUNT(*)s execute slower than in MyISAM due to tablespace complexity.

  15. What are HEAP tables in MySQL?
HEAP tables are in-memory. They are usually used for high-speed temporary storage. No TEXT or BLOB fields are allowed within HEAP tables. You can only use the comparison operators = and <=>. HEAP tables do not support AUTO_INCREMENT. Indexes must be NOT NULL.
  
  16. How do you control the max size of a HEAP table?
MySQL config variable max_heap_table_size.
  
  17. What are CSV tables?
Those are the special tables, data for which is saved into comma-separated values files. They cannot be indexed.
  
  18. Explain federated tables.
Introduced in MySQL 5.0, federated tables allow access to the tables located on other databases on other servers.
  
  19. What is SERIAL data type in MySQL?
BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT
  
  20. What happens when the column is set to AUTO INCREMENT and you reach the maximum value for that table?
It stops incrementing. It does not overflow to 0 to prevent data losses, but further inserts are going to produce an error, since the key has been used already.
  
  21. Explain the difference between BOOL, TINYINT and BIT.
Prior to MySQL 5.0.3: those are all synonyms. After MySQL 5.0.3: BIT data type can store 8 bytes of data and should be used for binary data.
  
  22. Explain the difference between FLOAT, DOUBLE and REAL.
FLOATs store floating point numbers with 8 place accuracy and take up 4 bytes. DOUBLEs store floating point numbers with 16 place accuracy and take up 8 bytes. REAL is a synonym of FLOAT for now.
  
  23. If you specify the data type as DECIMAL (5,2), what’s the range of values that can go in this table?
999.99 to -99.99. Note that with the negative number the minus sign is considered one of the digits.
  
  24. What happens if a table has one column defined as TIMESTAMP?
That field gets the current timestamp whenever the row gets altered.
  
  25. But what if you really want to store the timestamp data, such as the publication date of the article? Create two columns of type TIMESTAMP and use the second one for your real data.
  
  26. Explain data type TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
The column exhibits the same behavior as a single timestamp column in a table with no other timestamp columns.
  
  27. What does TIMESTAMP ON UPDATE CURRENT_TIMESTAMP data type do?
On initialization places a zero in that column, on future updates puts the current value of the timestamp in.
  
  28. Explain TIMESTAMP DEFAULT ‘2006:09:02 17:38:44′ ON UPDATE CURRENT_TIMESTAMP.
A default value is used on initialization, a current timestamp is inserted on update of the row.
  
  29. If I created a column with data type VARCHAR(3), what would I expect to see in MySQL table? CHAR(3), since MySQL automatically adjusted the data type.

yum


Using yum:
yum install package...
yum remove package...
yum update [package...]

Searching packages/files:
yum search searchterm
yum list (all | available | extra | installed | recent | updates )
yum info packagename

Searching files:
yum whatprovides filename

Configuring Additional Repositories:
Create a file in /etc/yum.repos.d for your repository

Required Information:
[repo-name]
name=A nice description
baseurl=http://yourserver.com/path/to/repo
enabled=1
gpgcheck=1

Creating a private repository:
1. crate a directory to hold your packages
2. Make this directory available by *http/ftp*
3. install the *createrepo* RPM
4. Run * createrepo -v /package/directory *
5. This will create a * repodata subdirectory and the needs support files 


About Me

About Me:

Following the links where you can find few of my details and site information:

My LinkedIn profile: http://in.linkedin.com/pub/amit-mund/3/884/b9

Site: https://sites.google.com/site/amitmund/

Meetup: http://www.meetup.com/lspe-in/

How to setup ssh environment with a password bashed key pairs

1. Background:

The purpose of this document is to overcome the issue that we face at our AWS environment. Its true that amazon not keeping our private key, when we have create a new instance. But we are not very strict about those aws keys, most of the team inside the company use the key and keep the same in lots of the place, and this can cause of a security hole.

Example:

Let say foo.com is an online company and the qa environment people is not keeping track of where the keys are keeping. They are not very sure about the keys. Let say if any of the qa team person kept the key at document root and later some how that key got into hand of some cracker, then he/she can log-in to the QA environment and that's compromise our environment.

2. What we can do?

Its true that without the key no one can able to log-in. But we don't even want to share those aws keys to everyone.

So, create your own ssh-key pairs, with a pass-phase.

1. ssh-keygen [enter]
2. select your preferred key type [rsa / dsa] or can go for the default one. [ enter ] 
3. in pass-phase enter a password. 

After that you can update the public key of that key pairs to qa server's authorized_keys and share the QA team. Now onwards when ever they want to login to the qa servers, they can use the same key from a blessed host. [ You can create a secure host, from where every-one login to company servers]. And you can protect the blessed hosts in the same way.

3. Question(s)?

How do I perform the automation:

You can do the following for that:

1. Log in to bless host [ with your personal keys ].
2. use "ssh-agent bash" [ I am using bash, you can use any of your shell ]
3. ssh-add [ at this time it will ask for the password, provide the password. ]

Later you can log-in to the qa server from the bless hosts without typing the password again and again.

You might also like to go through "screen" command.

4. Further reading:
 
Please go through further documentation on the following command for more details:

ssh-keygen
ssh-agent
ssh-add
screen


Wednesday 12 June 2013

Mysql Notes1


1. mysql errcode:24

 mysqldump: Couldn't execute 'show fields from `tablename`': Out of resources when opening file './databasename/tablename#P#p125.MYD' (Errcode: 24) (23)

For above kind of problem, you might need to check the ulimit value of system and mysql user.

- login as mysql user: [ sudo -u mysql bash ]
- ulimit -a [ check for the ulimit values ]
- update the /etc/security/limits.conf

If you find the ulimit is less for the mysql user, you can update the same.

# sudo lsof -p <pid_of_mysql> | wc -l  
The above command will let you know how many file is getting used by the mysql process.

mysql> show variables like 'open%';


2. To delete unwanted mysql database partition:

for i in {n1..n2}; do mysql -uroot --pPassword -e "use database_name; alter table tablename_x drop partition p$i;" ;done

In the above base script, n1 and n2 are starting of unwanted mysql database partition number and end of unwanted mysql databse partition number.


To recheck there should not have unwanted mysql table partition:
show create table table_name_x \G



web_accelerator

I am trying understand some open web accelerator, and as of now going through the data from http://en.wikipedia.org/wiki/Web_accelerator  and found following is the order: if I have to chose a open web accelerator:

1. Varnish: http://en.wikipedia.org/wiki/Varnish_(software)
2. Nginx: http://en.wikipedia.org/wiki/Nginx
3. Squid: http://en.wikipedia.org/wiki/Squid_(software)
4. trafficServer: http://trafficserver.apache.org/  [ ATS: Apache Traffic Server ]

Technologies

NOTE:


www.apache.org have so many new things to learn. Follow the new stuffs over there and you can learn a lots, that is new to the IT.


Few more new technologies:
- Apache Mesos -> http://mesos.apache.org/
  Making it easy to build resource-efficient distributed systems

- Spark -> http://spark-project.org/ :

Spark is an open source cluster computing system that aims to make data analytics fast — both fast to run and fast to write.
Spark is also the engine behind Shark, a fully Apache Hive-compatible data warehousing system that can run 100x faster than Hive.To run programs faster, Spark provides primitives for in-memory cluster computing

http://spark-project.org/examples/

Few top Sites:
https://amplab.cs.berkeley.edu/projects/
http://www.apache.org

Spark, 
Shark, 
GraphX, 
ZooKeeper
https://github.com/amplab/shark/wiki
http://spark-project.org/docs/latest/
https://github.com/amplab/shark/wiki
https://amplab.cs.berkeley.edu/projects/
http://www.scala-lang.org/







•High quality technical documentation, runbooks, diagrams.
•PCI-DSS compliance and implementation.
•Platforms - CentOS/RHEL, Debian, Solaris and FreeBSD.
•Shell scripting, Automation, UNIX/GNU tools.
•Deep understanding of critical networking fundamentals, tools, protocols.
•Virtualization - VMWare Vsphere, ESX/ESXi, Xen.
•Security - Bluecoat, Checkpoint, ASA/PIX, SonicWall.
•Hardware - Dell, HP, Sun, Cisco, IBM, EMC, Netapp, Hitachi
•MTA/SMTP - Postfix/Sendmail, Exchange, Zimbra
•Enterprise Monitoring - Nagios, SolarWinds, Cacti, BMC.
•ITIL - problem/incident management, change management, continual service improvement.

Specialties: Enterprise Systems Administration, Infrastructure Design/Architecture, Automation, HA/DR, Linux, UNIX, Scripting, Bash, Perl, Python, Apache, MySQL, SAN/NAS, Virtualization, LDAP, Virtualization, SMTP, Postfix, VMWare, Xen, Enterprise Server Hardware (HP, Dell, Sun, Cisco, IBM), Enterprise Monitoring (Nagios, BMC Patrol, SolarWinds Orion, Zenoss, Cacti), PCI-DSS, Bluecoat, Netscaler/F5, Active Directory, Exchange, DLP, iptables, MSSQL



*) Technology:

Zabbix
glusterfs
monit
bacula : -> open source network backup.
powerdns

nagios
puppet
Cacti
OpenTSDB
ganglia
Flume
Hadoop
logstash
graphite

Technology I need to learn:
GFS, BigTable, MapReduce, Chubby and large-scale 'cloud computing' clusters.
Languages: Python, Ruby, PHP, Perl, Javascript, Shell
SQL/Database : MySQL, SQLite, Cassandra
Distributed Caches: Redis, Memcache
Distributed Processing: Hadoop + Pig + ZooKeeper + Mahout
Cloud Platforms: Amazon Web Services, Google App Engine, Microsoft Azure
Protocols: XMPP, Jingle, ICE, RTSP, SMTP, POP, IMAP
Installers: NSIS
Code Repository Tools: Git, SVN, CVS
Collaboration: JIRA, Confluence
Build Management: Ant, Maven, MsBuild, Nant, Glu, Hudsan
OS: Linux (Redhat, CentOS), Ubuntu, freebsd
Monitoring: Nagios, Cactii, Ganglia, nagiosgraph, RRDTools, Ntop
CI: Teamcity, Clover, Hudson
Config Management: Puppet
Infrastructure: ServerIron Load Balancers,
File Systems: Ext3, NTFS, XFS, GFS
Mail Servers: Qmail, Postfix, Sendmail
App/Web Servers: Tomcat, Resin, IIS, PHP Accelerator, Jetty, apache http
Mailing List: Exmlm, Mailman, Sympa
Jabber Servers: eJabberd, Tigase, Openfire
VOIP Servers: Asterisk
DNS Servers: BIND, Power DNS,
Proxy servers: Squid, ISA, Perdition, NGinx, Varnish, Perlbal
Few more: tcp/ip, http, load balancers, web servers, memcache,
DB Replication: Slony, MSSQL Replication
FTP Servers: Proftpd, VSftpd
Virtualization: Xen, VmWare
Patch Management: WSUS, Yum, up2date
Apache, memcached, Squid, MySQL, NFS, DHCP, NTP, SSH, DNS, and SNMP
Advanced knowledge of Linux, TCP/IP and web services
A strong background in internet service deployment, provisioning, IP networking, service infrastructure, or software deployments.
Bootstrap, other, awk, sed, tc, cfengine, openNMS, MRTC, OpenVPN, HAProxy.
Security and venerability tools, CISSP, CEH tools.
Storage. 
Dbugging tools, gd, firefox web tools: greasemonkey and other imp web imp tools/plugins.

Queue system: [ Message Broker ]
. Gearman
. RabbitMQ
. ZeroMQ
. Amazon SQS
. WebSphere  MQ [ MQSeries ]
. Advanced Message Queuing Protocol [ AMQP ]
. http://en.wikipedia.org/wiki/Gearman
. Redis
- web analytics softwares:  [ Analog, AWStats,CrawlTrack, Open Web Analytics, Piwik, W3Perl, Webalizer, syslog-ng ]
- awstat [ sudo apt-get install awstat ] at browser: file:///usr/share/doc/awstats/html/index.html
- webalizer [ web log analysis software ]
- nodejs
- mongodb

Development
Languages: Scala, Python, Ruby, Java, C#, VB.net, PHP, VC++, C++, Perl, XUL, Javascript, C, Shell
Web Technologies: HTML 5, CSS, Dojo, jQuery, YUI, Flash, Silverlight
Frameworks & Libraries: Hibernate, Hibernate Shards, Spring, Apache MINA, Project Grizzly, log4j, XAPool, Poolman
RDBMS: Postgres, MySQL, Microsft SQL Server, Firebird, SQLite
NoSql Stores: Redis, Cassandra, Voldemort, Berkeley DB
Distributed Caches: Redis, Memcache
Distributed Queues: Kestrel, RabbitMQ
Distributed Processing: Hadoop + Pig + ZooKeeper + Mahout
Cloud Platforms: Amazon Web Services, Google App Engine, Microsoft Azure
Protocols: XMPP, Jingle, ICE, RTSP, SMTP, POP, IMAP
Scripting: Perl, Python, Ruby
Unit Testing: JUnit, NUnit, MbUnit
Stress Testing: Jmeter, Tsung, Iozone, Iometer, Bonnie, Bonnie++
Functional Testing: Watir, Selenium
Installers: NSIS
Code Repository Tools: Git, SVN, CVS
Collaboration: JIRA, Confluence
Build Management: Ant, Maven, MsBuild, Nant
CI: Teamcity, Clover, Hudson
IDEs: Aptana, Komodo, Eclipse, IntelliJ, Visual Studio, EMacs!
System Administration
OS: Linux (Redhat, CentOS), Windows
Monitoring: Nagios, Cactii, Ganglia
Config Management: Puppet
Infrastructure: ServerIron Load Balancers, Cisco ASA Firewall, FC/iSCSI SANs (Comet, Dell)
Scripting: Bash, Perl, Expect, Python, PHP, VBS, Powershell
File Systems: Ext3, NTFS, XFS, GFS
Other: DRBD, Heartbeat, ldirectord, RIS, LVS
Servers
App/Web Servers: Tomcat, Resin, IIS, PHP Accelerator, Jetty
Mail Servers: Qmail, Postfix, Sendmail
Mailing List: Exmlm, Mailman, Sympa
Antivirus / Antispam: clamd, Razor, Kaspersky server, Pyzor, Policyd, RBL/DNSBL
Jabber Servers: eJabberd, Tigase, Openfire
VOIP Servers: Asterisk
DNS Servers: BIND, Power DNS, DLZ, Microsoft DNS
Proxy servers: Squid, ISA, Perdition, NGinx, Varnish, Perlbal
DB Replication: Slony, MSSQL Replication
FTP Servers: Proftpd, VSftpd
Virtualization: Xen, VmWare
Patch Management: WSUS, Yum, up2date
UI
UI Prototyping: Balsamiq, Axure
Design: Photoshop, Flash, Coreldraw
Web: ECMAscript (actionscript/javascript), RSS, XML, HTML (4.01), XHTML, CSS1.0 & CSS2.1


Few companies are looking for the following skills for there "Site Reliability Engineer" (SRE) :

real-time metrics
deployment
Apache Http
Nginx
mysql
node.js
solr
Ruby
perl
python
java
php
Lucene
Scala
system level thinking ability
SOLR or Lucene
Scala
Performance Tuning
chef
puppet
unix
Scrum
FreeBSD
Ubuntu
Redhat
Hadoop
Riak
ZooKeeper
RabbitMQ
Haproxy
AWS
OpenStack
Cloud Foundry
Heroku
Linux Kernel Internals
Filesystems
High availability
High performance
High security
Salt
SVN, GIT
PostgreSQL
Cassandra
Mysql
tcpdump
device drivers
FreeBSD
dtrace
ktrace
load balancing
LAMP stack
column stores
erlang
haskell
scala
scheme
tcp/ip
http
security
storage
memcache
code-review
Sharing and Guding others
capistrano
mesos
scribe
capacity planing
CDN
memcached
squid
nfs
dhcp
ntp
ssh
dns
snmp
Varnish
Redis
Nagios/Icinga
OpenTSDB

Artifactory Repository