Recent Comments
Author Archives: fencatn
Day02.Mysql基本操作
1,创建2个表,练习约束条件 mysql> create database test; Query OK, 1 row affected (0.00 sec) mysql> use test; Database changed mysql> create table tea(name varchar(4) not null,gender enum(‘boy’,’girl’) default “boy”,interest set(‘book’,’film’,’music’,’football’)); Query OK, 0 rows affected (0.36 sec) mysql> desc tea; +———-+—————————————+——+—–+———+——-+ | … Continue reading
Day01.Mysql初始化安装
[root@50 mysql]# grep password /var/log/mysqld.log 2018-09-06T03:35:28.791445Z 1 [Note] A temporary password is generated for root@localhost: <:6hlKMNfoUM
Day15.Mycat分库分表
Mycat 分库分表 IP规划 client 192.168.4.254 Mycat 192.168.4.56 c1 192.168.4.55 c2 192.168.4.54 [root@56 ~]# tar -xf Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz [root@56 ~]# ll 总用量 985192 -rw——-. 1 root root 1838 1月 30 2018 anaconda-ks.cfg -rw-r–r–. 1 root root 169714648 9月 17 17:10 databases2.sql -rw-r–r–. … Continue reading
Day14.Mysql视图
mysql> select * from user; +—-+———————+——+——+——+—————————————————————–+—————————+—————-+——+———-+———-+ | id | username | pass | uid | gid | comment | homedir | shell | sex | homedir2 | pay | +—-+———————+——+——+——+—————————————————————–+—————————+—————-+——+———-+———-+ | 1 | root | x | 0 | 0 … Continue reading
Day13.MHA高可用配置方法
物理备份 rm -rf /var/lib/mysql/* systemctl stop mysqld rm -rf /var/lib/mysql 把刚才的备份文件拷贝到的当前库下 scp 192.168.4.50:/root/mysql.bak /var/lib/mysql/ 重启正常 重新初始化数据库 1、停数据库服务 systemctl stop mysqld 2、删除库 rm -rf /var/lib/mysql/* 3、重新启动,mysql数据库会自己检测 [root@51 mysql]# grep password /var/log/mysqld.log | tail 2018-09-13T02:33:34.691299Z 0 [Note] Shutting down plugin ‘sha256_password’ 2018-09-13T02:33:34.691305Z … Continue reading
Day11.Mysql主从配置
1、配置主-从-从结构,并做各种测试 第一步,配置主库51 vim /etc/my.cnf [root@51 mysql]# grep -v “^#” /etc/my.cnf | grep -v “^$” [mysqld] validate_password_policy = 0 validate_password_length = 6 datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock symbolic-links=0 log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid log-bin=master51 server_id=51 binlog_format=”mixed” [root@51 mysql]# systemctl restart mysqld [root@51 mysql]# mysql -uroot -p123456 mysql> … Continue reading
创建Redis集群(重新修改)
创建Redis集群 为6台主机安装并运行redis服务 # yum -y install gcc gcc-c++ # tar -zxvf redis-4.0.8.tar.gz # cd redis-4.0.8/ # make # make install # ./utils/install_server.sh • 调整配置文件 # vim /etc/redis/redis.conf bind IP地址 //只写物理接口IP地址 daemonize yes //守护进程方式运行 port xxxx //端口号不要使用默认的6379 cluster-enabled yes//启用集群 cluster-config-file nodes-xxxx.conf//指定集群信息文件 … Continue reading
Redis绑定IP后报 bind: Cannot assign requested address 异常解决方法
Redis绑定IP后报 bind: Cannot assign requested address 异常解决方法 今天在研究Redis安全设置,提到bind IP地址,然后就在redis.conf文件中的bind项后加入了客户端的IP,以为是绑定了IP的机器才能访问Redis,修改完成后重启,报错了: Creating Server TCP listening socket 192.168.1.55:6379: bind: Cannot assign requested address 提示监听192.168.1.55地址的6379端口错误,无法分配请求地址! 报着疑问,百度了一下,发现原来是我理解错了bind关键字的意义,原来的作用是绑定本机IP和地址 这个是知乎上的解答:http://www.zhihu.com/question/27220050/answer/38463570 redis.conf中的原文解释: # By default Redis listens for connections from all the network interfaces # available on the … Continue reading
安装redis make报错 zmalloc.h:50:31: 错误:jemalloc/jemalloc.h:没有那个文件或目录
原因分析: 在redis的解压包下有个README文件,打开这个文件 有这个一段话。 llocator ——— Selecting a non-default memory allocator when building Redis is done by setting the `MALLOC` environment variable. Redis is compiled and linked against libc malloc by default, with the exception of jemalloc being the default on Linux … Continue reading
Linux查找包名
Linux查找包名 一、rpm包安装的,可以用rpm -qa看到,如果要查找某软件包是否安装,用 rpm -qa | grep “软件或者包的名字” 。 [root@fencatn ~] rpm -qa | grep ruby 二、以deb包安装的,可以用dpkg -l能看到。如果是查找指定软件包,用dpkg -l | grep “软件或者包的名字” ; [root@fencatn ~]dpkg-l|grepruby 三、yum方法安装的,可以用yum list installed查找,如果是查找指定包,命令后加 | grep “软件名或者包名” ; [root@fencatn ~] yum list installed | grep ruby … Continue reading