React Q&A

React.PureComponent

The difference between React.PureComponent and React.Component is that React.Component doesn’t implement shouldComponentUpdate(), but React.PureComponent implements it with a shallow prop and state comparison.

Deploy MySQL as RDS MySQL Slave

Use Alibaba Cloud ECS to Build RDS MySQL Slave Database

Friendly reminder: The steps to install MySQL software will not be introduced in this article. After installing MySQL, you do not need to worry about initializing the database and starting the service. Just make sure that the installed MySQL version is not lower than the Alibaba Cloud RDS MySQL version, and create a new MySQL system user running the MySQL service in advance. For safety, part of the content has been mosaicked. The master-slave mode is determined by the version of RDS MySQL. This article mainly uses RDS MySQL version 5.6 as an example and uses the new GTID mode as the master and slave. The 5.5 version is more simple to configure the master and slave. The first 15 steps are the same. There are no 16 and 17 operations. The 18th step uses the traditional mode of binlog file and location as the master and slave. You can modify the corresponding SQL statement, so I won’t add more explanation here.

Alibaba Cloud uses the open source Percona Xtrabackup tool to do full physical backup of RDS MySQL. Using Alibaba Cloud ECS self-built slave library still needs to use this tool to import full backup data. In order to solve the package dependency problem encountered during installation, it is recommended to install Percona Xtrabackup using yum, and it is recommended to install the latest version.

Linux RAID 1 Setup

RAID 1

RAID stands for Redundant Array of Inexpensive Disks, There are many RAID levels such as RAID 0, RAID 1, RAID 5, RAID 10 etc. we will set up software RAID 1 on a running Linux distribution.

Drag and Click

The Demo Webpage to Tell Drag and Click

Sometimes it’s not that intuitive to tell drag and click event, as both of them are detecting mousedown event. The following script handles this problem, and provide basic drag and click functions.

MySQL Full Unicode Support

Firstly, to check that which tables need to change the char set.

1
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA= "moodle" AND TABLE_TYPE="BASE TABLE" AND `TABLE_COLLATION` <> "utf8mb4_unicode_ci"

And then, generate the SQL which need to be executed.

1
SELECT CONCAT('ALTER TABLE `', TABLE_NAME,'` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;') AS mySQL FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA= "moodle" AND TABLE_TYPE="BASE TABLE" AND `TABLE_COLLATION` <> "utf8mb4_unicode_ci"

Moodle Upgrade

This is an article to document the process of upgrading of moodle from 3.5 to 3.9(which is the latest version by now).

Check plugins installed locally

1
SELECT * FROM `mdl_config_plugins` where plugin like 'local%'

Preparation

1
2
mv moodle moodle35
tar xvzf moodle-latest-3.9.tgz

Kylin Demo

First and formost, Login in server 115.

Docker image and container

Image

1
2
3
4
5
[root@c8-2 aemg]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
kylin_sqoop 20200708 9dffd69df6f6 24 hours ago 3.91GB
apachekylin/apache-kylin-standalone 3.1.0 2ce49ae43b7e 6 days ago 2.56GB
docker.elastic.co/elasticsearch/elasticsearch 7.8.0 121454ddad72 3 weeks ago 810MB

kylin_sqoop is the image integrated with kylin and sqoop tool.

Docker Practice

Docker commit

This move save container to a new image.

1
2
3
4
5
[root@c8-2 ~]# docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
388e9b6f5a75 docker.elastic.co/elasticsearch/elasticsearch:7.8.0 "/tini -- /usr/local…" 2 hours ago Up 2 hours 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp elasticsearch
070dd7124d70 apachekylin/apache-kylin-standalone:3.0.1 "/home/admin/entrypo…" 8 days ago Up 2 hours 0.0.0.0:7070->7070/tcp, 0.0.0.0:8032->8032/tcp, 0.0.0.0:8042->8042/tcp, 0.0.0.0:8088->8088/tcp, 0.0.0.0:16010->16010/tcp, 0.0.0.0:50070->50070/tcp kylin