Posts

Showing posts from October, 2021

Digital Marketing

Just because you're wearing a seatbelt doesn't mean you're not going to die in a car accident.

Crontab on Boot: Run a Cron Job at Boot Time

Example: @reboot socat -d -d -lmlocal2 tcp4-listen:3306,bind=0.0.0.0,reuseaddr,fork tcp4:192.168.0.18:3306

This option --tab should be used only when mysqldump is run on the same machine as the mysqld server.

 --tab=dir_name, -T dir_name produce tab-separated text-format data files. For each dumped table, mysqldump creates a tbl_name.sql file that contains the CREATE TABLE statement that creates the table, and the server writes a tbl_name.txt file that contains its data. The option value is the directory in which to write the files. This option should be used only when mysqldump is run on the same machine as the mysqld server. Because the server creates *.txt files in the directory that you specify, the directory must be writable by the server and the MySQL account that you use must have the FILE privilege. Because mysqldump creates *.sql in the same directory, it must be writable by your system login account.

The ex-dividend date is the day a share starts trading without its dividend payment.

tmux Ctrl+B Cheat Sheet

 Session Commands S: List sessions. $: Rename current session. D: Detach current session. Ctrl+B, and then ?: Display Help page in tmux. Window Commands C: Create a new window. ,: Rename the current window. W: List the windows. N: Move to the next window. P: Move to the previous window. 0 to 9: Move to the window number specified. Pane Commands %: Create a horizontal split. “: Create a vertical split. H or Left Arrow: Move to the pane on the left. I or Right Arrow: Move to the pane on the right. J or Down Arrow: Move to the pane below. K or Up Arrow: Move to the pane above. Q: Briefly show pane numbers. O: Move through panes in order. Each press takes you to the next, until you loop through all of them. }: Swap the position of the current pane with the next. {: Swap the position of the current pane with the previous. X: Close the current pane.

Starting a Named tmux Session

 tmux new -s goyun-info-session

Aurora MySQL–based DB clusters running Aurora Serverless v1 don't support replicating data using replication based on binary logs

This limitation is true regardless of whether your Aurora MySQL-based DB cluster Aurora Serverless v1 is the source or the target of the replication. To replicate data into an Aurora Serverless v1 DB cluster from a MySQL DB instance outside Aurora, such as one running on Amazon EC2, consider using AWS Database Migration Service. For more information, see the AWS Database Migration Service User Guide .

Delete multiple files in S3 bucket with AWS CLI

 aws s3 rm s3://goyun-info-bucket/ --recursive

MySQL: disable foreign key check

 SET foreign_key_checks = 0 ;

Connect to MySQL by TCP instead of a Unix socket

 mysql --protocol tcp

Using socat as MySQL proxy

On the proxy server: yum install socat      socat -d -d -lmlocal2 tcp4-listen:database port,bind=0.0.0.0,reuseaddr,fork tcp4:source_database_ip_address:database_port &

Foreign keys issue when swapping MySQL tables by renaming

When you swap MySQL tables by renaming,  you need to manually update all the affected foreign keys. Use Sakila as example: mysql> SELECT TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_NAME = 'address' and TABLE_SCHEMA = 'sakila'; +------------+-------------+---------------------+-----------------------+------------------------+ | TABLE_NAME | COLUMN_NAME | CONSTRAINT_NAME | REFERENCED_TABLE_NAME | REFERENCED_COLUMN_NAME | +------------+-------------+---------------------+-----------------------+------------------------+ | customer | address_id | fk_customer_address | address | address_id | | staff | address_id | fk_staff_address | address | address_id | | store | address_id | fk_store_address | address | address_id | +------------+-------------+---------------------+-----------------------+------------------------+ 3 rows in set (0.01 sec) mysql> insert into ad

Backup files from Amazon S3 can only be restored to a new DB instance on Amazon RDS , not an existing one.

For more information on importing backup files from Amazon S3 to Amazon RDS limitations  refer to https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.html#MySQL.Procedural.Importing.Limitations

Fixed: "MySQL server is running with the –secure-file-priv” Error

The variablesecure_file_priv is used to limit the effect of data import and export operations.  Example of the affected operations is those performed by the LOAD DATA andSELECT ... INTO OUTFILE statements and the functionLOAD_FILE(). These operations are permitted only to users who have the FILE privilege. mysql> SHOW VARIABLES LIKE "secure_file_priv"; +------------------+-----------------------+ | Variable_name | Value | +------------------+-----------------------+ | secure_file_priv | /var/lib/mysql-files/ | +------------------+-----------------------+ Changing secure-file-priv variable directory [mysqld] secure-file-priv=/new-location sudo systemctl restart mysqld Diable secure-file-priv variable To disable it, set the variable to an Empty value. [mysqld] secure-file-priv = "" sudo systemctl restart mysqld

Monitor MySQL replication

The most important variables are Slave_IO_Running, Slave_SQL_Running and Seconds_Behind_Master. Two first variables should be equal to ‘Yes’, and Seconds_Behind_Master should be 0 or close to it. These variables indicate that both replication threads are running and slave is up to date with master.

Continuous Integration and Continuous Deployment

Continuous Integration is a software development practice where continuous changes and updates in code base are integrated and verified by an automated build scripts  using various tools. Continuous Deployment is a software development practice to automatically deploy the code to the specified server and application folder once the code is been integrated successfully.

The difference between @channel and @here and @everyone in slack

@everyone can only be used in the #general channel, which is a channel that all members (except guests) are automatically added to. This mention will notify everyone in the #general channel whether their availability is set to active or away. The @here command lets you grab the attention of team members in a channel who are currently active. The @channel command, on the other hand, will send a message to all team members of the channel, whether they are currently signed in and active or not. @everyone notifies every person in the #general channel, @channel notifies all members of a channel, and @here notifies only the active members of a channel.

The permissions required to start replication on an Amazon RDS DB instance are restricted and not available to your Amazon RDS master user.

You must use either the Amazon RDS mysql.rds_set_external_master command or the mysql.rds_set_external_master_gtid command to configure replication, and the mysql.rds_start_replication command to start replication between your live database and your Amazon RDS database.

Check bin logs for MySQL

mysql> show global variables like '%log_bin%'; +---------------------------------+--------------------------------+ | Variable_name | Value | +---------------------------------+--------------------------------+ | log_bin | ON | | log_bin_basename | /var/lib/mysql/mysql-bin | | log_bin_index | /var/lib/mysql/mysql-bin.index | | log_bin_trust_function_creators | OFF | | log_bin_use_v1_row_events | OFF | +---------------------------------+--------------------------------+ mysql> show global variables like '%binlog_format%'; +---------------+-----------+ | Variable_name | Value | +---------------+-----------+ | binlog_format | STATEMENT | +---------------+-----------+ mysql> show binary logs; +------------------+-----------+ | Log_name | File_size |

AWS RDS master user does not contain super privileges.

As RDS is managed service, there are certain access restricted for master user for platform stability.

MTR combines the functionality of both the Ping and alternatives of traceroute Utilities

MTR - My Traceroute MTR providing a robust tool for troubleshooting purposes. Example: $ mtr -r -T -P 443 goyun.info .s3.ca-central-1.amazonaws.com

Burn Linux ISO to USB

Step 1: Download and install UNetbootin from here , then launch it on your computer. Step 2: Click Diskimage if you already had a copy of Linux ISO. If not, select a distribution from the list and download the ISO file. Step 3: Check the box next to Diskimage box and then import Linux ISO image file. After that, select USB drive name and hit the OK button to start burning ISO to USB

Access ASUS Laptop BIOS

For most ASUS laptops, the key you use to enter BIOS is F2, and as with all computers, you enter BIOS as the computer is booting up. However, unlike on many laptops, ASUS recommends that you press and hold the F2 key before you switch on the power.

AWS S3 supports both Server Side Encryption and Client Side Encryption for your data at rest or stored data at disk.

In Server Side Encryption, when you upload an object, S3 encrypts it before storing into the disk and decrypts it before you access/download your data. In Client Side Encryption, you need to encrypt your data before sending it to AWS S3 and you are responsible for decrypting it after to retrieve it from S3.