Posts

Creating a Custom Amazon Machine Image (AMI)

Image
When you create an AWS Elastic Beanstalk environment, you can specify an Amazon Machine Image (AMI) to use instead of the standard Elastic Beanstalk AMI included in your platform configuration's solution stack. A custom AMI can improve provisioning times when instances are launched in your environment if you need to install a lot of software that isn't included in the standard AMIs. Using .ebextensions is great for configuring and customizing your environment quickly and consistently. Applying configurations, however, can start to take a long time during environment creation and updates. If you do a lot of server configuration in .ebextensions , you can reduce this time by making a custom AMI that already has the software and configuration that you need. A custom AMI also allows you to make changes to low level components, such as the Linux kernel, that are difficult to implement or take a long time to apply in .ebextensions . You can b...

DynamoDB for Javascript – cheatsheet

The following snippets can be used for interacting with AWS DynamoDB using AWS Javascript API. PutItem var params = { TableName: 'table_name', Item: { // a map of attribute name to AttributeValue attribute_name: { S: 'STRING_VALUE' } // more attributes... }, Expected: { // optional (map of attribute name to ExpectedAttributeValue) attribute_name: { Exists: true, // optional (if false, Value must be null) Value: { S: 'STRING_VALUE' }, }, // more attributes... }, ReturnValues: 'NONE', // optional (NONE | ALL_OLD) ReturnConsumedCapacity: 'NONE', // optional (NONE | TOTAL | INDEXES) ReturnItemCollectionMetrics: 'NONE', // optional (NONE | SIZE) }; dynamodb.putItem(params, function(err, data) { if (err) console.log(err); // an error occurred else console.log(data); // successful response }); UpdateItem var params = { Ta...

Reserved Words in DynamoDB

The following keywords are reserved for use by DynamoDB. Do not use any of these words as attribute names in expressions. ABORT ABSOLUTE ACTION ADD AFTER AGENT AGGREGATE ALL ALLOCATE ALTER ANALYZE AND ANY ARCHIVE ARE ARRAY AS ASC ASCII ASENSITIVE ASSERTION ASYMMETRIC AT ATOMIC ATTACH ATTRIBUTE AUTH AUTHORIZATION AUTHORIZE AUTO AVG BACK BACKUP BASE BATCH BEFORE BEGIN BETWEEN BIGINT BINARY BIT BLOB BLOCK BOOLEAN BOTH BREADTH BUCKET BULK BY BYTE CALL CALLED CALLING CAPACITY CASCADE CASCADED CASE CAST CATALOG CHAR CHARACTER CHECK CLASS CLOB CLOSE CLUSTER CLUSTERED CLUSTERING CLUSTERS COALESCE COLLATE COLLATION COLLECTION COLUMN COLUMNS COMBINE COMMENT COMMIT COMPACT COMPILE COMPRESS CONDITION CONFLICT CONNECT CONNECTION CONSISTENCY CONSISTENT CONSTRAINT CONSTRAINTS CONSTRUCTOR CONSUMED CONTINUE CONVERT COPY CORRESPONDING COUNT COUNTER CREATE CROSS CUBE CURRENT CURSOR CYCLE DATA DATABASE DATE DATETIME DAY DEALLOCATE DEC DECIMAL DECLARE DEFAULT DEFERRABLE DEFERRED DEFINE DEFINED DEFINIT...

MySql Slow Queries

MySQL has a slow query log which can be enabled if you want to identify the queries that are causing problems for a website or application. Checking slow queries is one of the most important steps in optimizing and tuning mysql. This article shows how to identify those 'slow queries' that need special attention and proper optimization. First let’s check on the server if slow query logging is enabled on MySql. On Windows cd c:\xampp\mysql\bin bin>mysqladmin var | find "log_slow_queries" On linux bin>mysqladmin var |grep log_slow_queries Enable the slow query log MySQL prior to 5.1.0 requires a change to the MySQL my.cnf file and a restart in order to log slow queries. From MySQL 5.1.0 you can apparantly change this dynamically without having to restart. Too make the change permanent, you could add the following lines under the [mysqld] section of your my.ini or my.cnf configuration file: >vi /etc/my.cnf [mysqld] # Activate the Slow Q...

Kill a blocking (long running) sql statement

You can use the command line tool mysqladmin to view processes which returns the processes with their IDs. Then use the kill option of mysqladmin to kill your blocking process by its process ID. /* get process ID of blocking process */ mysql/bin>mysqladmin -uroot -p processlist /* kill it */ mysql/bin>mysqladmin -uroot -p kill PreceessID If you are using mysql client tool and already logged in as root user. mysql> show processlist; /* get process ID from output and replace with PreceessID */ mysql> kill PreceessID; Note: Do not kill commands like Alter table, optimize table, check table...

Where is my MySQL database on the server?

Usually /var/lib/mysql or /var/db/mysql directory used to store database and tales under UNIX like operating systems. You can use the following command to locate MySQL datadir: On windows: >mysqladmin variables | findstr "datadir" on Linux : >mysqladmin variables | grep datadir OR >grep datadir /etc/my.cnf

Basic Examples to Learn MySQL

Just make sure that you have installed MySQL database server with xampp and have a valid username & password to access. So developers get ready to learn MySQL within couple of hours. End of the tutorial you can do: Create and Drop Database Create, Alter, Truncate and Drop Table Select, Insert, Update and Delete rows Group by, Order by, Having, Union, Distinct Add, drop index, Explain command database backup with mysqldump or mysqlhotcopy read more here