In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Mysq needs attention:
mysql master-slave replication delay comes from sql thread (solution: myslq5.7 can be set to multi-thread parallel)
Database monitoring:lepus
Delete large databases (safe and fast method to delete part by part)(Violent deletion is not recommended Delete DROP will cause master-slave inconsistency)
expire_log_days 0 (default database not deleted)
set global expire_logs_days=7
TiDB(distributed)
Data backup must be done on slave to avoid increasing the burden of master
Database cache: redis (disadvantages of nosql: data cannot be persisted because it works in memory and memory capacity is limited advantages: fast but redis can keep data working in memory data will be saved on disk)
Read-write separation: add proxy (database access layer proxy)
nosql database can connect directly to a redis (super fast)
But there is a relationship between data and data, so you have to connect mysql:
client (KV)-->redis --(hook function)>mysql
High concurrency mysql: (must go to read and write separation)
client --> middle key (specially developed to distribute and confirm customer requirements because LVS does not understand these and only forwards)-->LVS(development: equivalent routing extends multiple LVS)-->nginx (multiple LVS correspond to one nginx)-->BD(cluster)
Database cache: (redis)
Three virtual machines:
dd1:(nginx php)
Check if it has been installed before:
rpm -qa | grep php
rpm -qa | grep httpd
yum install -y nginx-1.8.0-1.el6.ngx.x86_64.rpm
rpm -ivh php-cli-5.3.3-38.el6.x86_64.rpm php-common-5.3.3-38.el6.x86_64.rpm
rpm -ivh php-mysql-5.3.3-38.el6.x86_64.rpmphp-pdo-5.3.3-38.el6.x86_64.rpm
yum install php-5.3.3-38.el6.x86_64.rpm
cd /etc/php-fpm.d
vim www.conf (change username user group nginx)
/etc/init.d/php-fpm start
netstat -antlpe | grep php
cd /etc/nginx/conf.d
vim default.conf (nginx opens php module)
nginx -t
nginx open nginx
netstat -antlpe | grep nginx
cd /usr/share/nginx/html/
Test:nginx php installed successfully
dd3:yum install mysql-server -y (version too low for testing only)
/etc/init.d/mysqld start
dd1:scp redis-3.2.5.tar.gz root@172.25.42.11:
dd2:
tar zxf redis-3.2.5.tar.gz
cd redis-3.2.5
make && make install
cd utils
./ install_server.sh
netstat -antlpe
cd /etc/redis
vim 6379.conf (bind listening port)
/etc/init.d/redis_6379 restart
redis-cli
dd1:(php loads redis module)
yum install unzip -y
unzip phpredis-master.zip
yum install php-devel-5.3.3-38.el6.x86_64.rpm
cd phpredis-master
phpize (specify module installation path)
./ configure
make && make install
vim/etc/php.ini (change time zone)
cd /etc/php.d
cp mysql.ini redis.ini
vim redis.ini
/etc/init.d/php-fpm reload
php -m |grep redis (check whether the module is loaded successfully)
cp test.php/usr/share/nginx/html/index.php (test page)
vim /usr/share/nginx/html/index.php
scp test.sql 172.25.42.12:(redis)(database content)
dd3:
grant select on test.* to redis@'172.25.42.% ' identified by 'westos'
select * from test
Testing:
Page test: the first visit is the database, the second visit is cache
Defect: If you update the contents of mysql database, cache will not notice, the data content inside will not change, when the user accesses, the old content in cache will still be obtained, and the old data in cache can only be manually deleted before updating again.
update test set name='westos'where id =1
redis master-slave:(backup) redis is a single-process solution: run multiple processes to bind the process to the cpu
dd3:(Different services have different ports, so in order to avoid opening more virtual machines, you can do it on dd3 ~)
tar zxf redis-3.2.5.tar.gz
cd redis-3.2.5
make && make install (yum install gcc -y)
cd utils/
./ install_server.sh
cd /etc/redis/
vim 6379.conf (slaveof)
/etc/init.d/redis_6379 restart
Test: redis-cli
Master-slave switching: (one master with multiple slaves, one master with dual slaves)
dd1:(Different services have different ports, so in order to avoid opening more virtual machines, you can do it on dd1 ~)
tar zxf redis-3.2.5.tar.gz
cd redis-3.2.5
make && make install (yum install gcc -y)
cd utils/
./ install_server.sh
cd /etc/redis/
vim 6379.conf (slaveof)
/etc/init.d/redis_6379 restart
cd redis-3.2.5
cp sentinel.conf /etc/redis
vim sentinel.conf
scp sentinel.conf root@172.25.42.12:/etc/redis/
scp sentinel.conf root@172.25.42.11:/etc/redis/
redis-server /etc/redis/sentinel.conf --sentinel (all three) (opens a new monitoring port)
View: redis-cli -p 26379 (26379: Monitor every port
redis-cli
127.0.0.1: 6379> monitor (master sends out contracts to slave every second)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.