标签:dep llb soc ini 机制 hdfs path l数据库 help
? 数据(data)是事实或观察的结果,是对客观事物的逻辑归纳,是用于表示客观事物的未经加工的原始素材,数据是信息的表现形式和载体,可以是符号,文字,数字,语音,图像,视频等,数据和信息是不可分离的,数据是信息的表达,信息是数据的内涵,数据本身没有任何意义,数据只有对实体行为产生影响才成为信息。在计算机系统中,数据以二进制信息单元0,1形式表示
? 数据库(Database): 是按照数据结构来组织、存储和管理数据的仓库,给我们提供了一种以关系的方式来存放数据的方法,能够解决文本性存储数据的劣势。
库中有表,几个表之间有关联的,拥有共同的列,称之为关系型数据库
Oracle # 1521
DB2 # 5000
Mysql,Mariadb # 3306
SQLServer # 1433
通常是以Key-value形式存储的,不支持SQL语句,没有表结构,配置简单,低廉学习成本,能很好作为Mysql中间层:
# 1. 键值存储: Redis<6379> Memcached<11211>,因为相比其他数据存储没有数据结构,又工作在内存中,所以性能很高.
# 2. 列式存储: HBase:
# 3. 文档存储: Documentation , MongoDB<27017>
分布式数据库: 通过分片机制进行数据分布,每个节点都能接收客户端请求<去中心化>,并且持有全局元数据的一部分数据.
# Hadoop(HDFS): 适用于大文件存储,Apache公司的产品,java程序编写
# FastDFS(开源软件): 适用于小文件存储(网盘,短视频,images),对于高并发有很好的支持.
# SQL语言主要用于存取数据,查询数据,更新数据和管理关系数据库系统,由IBM开发,分为四种类型
# DDL语句 数据库定义语言(Create,Alter,Drop,Declare)
# 用于定义或改变表的结构,数据类型,表之间的连接和约束等初始化工作上,他们大多在建表时使用.
# DML语句 数据库操作语言(Select,Delete,Update,Insert) # 用来对数据库里的数据进行操作的语言.
# DCL语句 数据库控制语言(GRANT,REVOKE,COMMIT,ROLLBACK)
# 用来设置或更改数据库或角色权限的语句,只有sysadmin,dbcreator,db_owner等人员才能执行.
# DQL语句 数据库查询语言(select)
安装rpm的Mysql
#!/usr/bin/env bash
# Author: ZhouJian
# Mail: 18621048481@163.com
# Time: 2019-9-3
# Describe: CentOS 7 Install Mysql.rpm Script
clear
echo -ne "\\033[0;33m"
cat<<EOT
_oo0oo_
088888880
88" . "88
(| -_- |)
0\\ = /0
___/‘---‘\\___
.‘ \\\\\\\\| |// ‘.
/ \\\\\\\\||| : |||// \\\ /_ ||||| -:- |||||- \\\ | | \\\\\\\\\\\\ - /// | |
| \\_| ‘‘\\---/‘‘ |_/ |
\\ .-\\__ ‘-‘ __/-. /
___‘. .‘ /--.--\\ ‘. .‘___
."" ‘< ‘.___\\_<|>_/___.‘ >‘ "".
| | : ‘- \\‘.;‘\\ _ /‘;.‘/ - ‘ : | |
\\ \\ ‘_. \\_ __\\ /__ _/ .-‘ / /
=====‘-.____‘.___ \\_____/___.-‘____.-‘=====
‘=---=‘
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
建议系统 CentOS7
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# PS:请尽量使用纯净的CentOS7系统,我们会在服务器安装Mysql5.7,
# 将mysql-5.7.23-1.el7.x86_64.rpm-bundle.tar包和脚本放到root目录下执行即可,密码为ZHOUjian.20
EOT
echo -ne "\\033[m"
init_security() {
systemctl stop firewalld
systemctl disable firewalld &>/dev/null
setenforce 0
sed -i ‘/^SELINUX=/ s/enforcing/disabled/‘ /etc/selinux/config
sed -i ‘/^GSSAPIAu/ s/yes/no/‘ /etc/ssh/sshd_config
sed -i ‘/^#UseDNS/ {s/^#//;s/yes/no/}‘ /etc/ssh/sshd_config
systemctl enable sshd crond &> /dev/null
echo -e "\033[32m [安全配置] ==> OK \033[0m"
}
init_yumsource() {
if [ ! -d /etc/yum.repos.d/backup ];then
mkdir /etc/yum.repos.d/backup
fi
mv /etc/yum.repos.d/* /etc/yum.repos.d/backup 2>/dev/null
if ! ping -c2 www.baidu.com &>/dev/null
then
echo "您无法上外网,不能配置yum源"
exit
fi
curl -o /etc/yum.repos.d/163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
timedatectl set-timezone Asia/Shanghai
echo "nameserver 114.114.114.114" > /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
chattr +i /etc/resolv.conf
echo -e "\033[32m [YUM Source] ==> OK \033[0m"
}
init_mysql() {
rpm -e mariadb-libs --nodeps
rm -rf /var/lib/mysql
rm -rf /etc/my.cnf
tar xvf /root/mysql-5.7.23-1.el7.x86_64.rpm-bundle.tar -C /usr/local/
cd /usr/local
rpm -ivh mysql-community-server-5.7.23-1.el7.x86_64.rpm mysql-community-client-5.7.23-1.el7.x86_64.rpm mysql-community-common-5.7.23-1.el7.x86_64.rpm mysql-community-libs-5.7.23-1.el7.x86_64.rpm |
rm -rf mysql-community-*
}
changepass() {
sed -i ‘/\[mysqld]/ a skip-grant-tables‘ /etc/my.cnf
systemctl restart mysqld
mysql <<EOF
update mysql.user set authentication_string=‘‘ where user=‘root‘ and Host=‘localhost‘;
flush privileges;
EOF
sed -i ‘/skip-grant/d‘ /etc/my.cnf
systemctl restart mysqld
yum -y install expect ntp
cat > /etc/ntp.conf << EOF
restrict default nomodify
server 127.127.1.0
fudge 127.127.1.0 stratum 10
EOF
systemctl start ntpd && systemctl enable ntpd
expect <<-EOF
spawn mysqladmin -uroot -p password "ZHOUjian.20"
expect {
"password" { send "\r" }
}
expect eof
EOF
systemctl restart mysqld
}
main() {
init_hostname
init_security
init_yumsource
init_mysql
changepass
}
main
# 修改Mysql密码下面有三种办法
# 1.刚安装好的mysql,可以从/var/log/mysqld.log获取临时密码
grep "password" /var/log/mysqld.log
[root@mysql ~]# mysql -uroot -p
Enter password:
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘ZHOUjian.22‘;
# 2.mysqladmin -uroot -p password "Baidu.123.com"
Enter password:
# 3.实验环境不知道root密码操作方法如下
sed -i ‘/\[mysqld]/ a skip-grant-tables‘ /etc/my.cnf
systemctl restart mysqld
mysql <<EOF
update mysql.user set authentication_string=‘‘ where user=‘root‘ and Host=‘localhost‘;
flush privileges;
EOF
sed -i ‘/skip-grant/d‘ /etc/my.cnf
systemctl restart mysqld
mysqladmin -uroot -p password "ZHOUjian.20"
Enter password: # 此处回车一下即可
# 4.mariadb修改密码
use mysql
UPDATE user SET password=password(‘ZHOUjian.20‘) WHERE user=‘root‘;
MariaDB [mysql]> flush privileges;
# 如果嫌登陆Mysql输入密码麻烦,可以使用以下办法,只需要mysql就可以进入数据库
vim /etc/my.cnf
[client]
password=admin
user=root
systemctl restart mysqld Or mariadb
# 安装源码Mysql
#!/usr/bin/env bash
# Author: ZhouJian
# Mail: 18621048481@163.com
# Time: 2019-9-3
# Describe: CentOS 7 Install Mysql.tar Script # 此处为编译好的tar包,具体编译有时间再亲测一遍
Deplay(){
rpm -e mariadb-libs --nodeps
setenforce 0
systemctl stop firewalld
systemctl enable firewalld
sed -i ‘/^SELINUX=/ s/enforcing/disabled‘ /etc/ssh/sshd_config
sed -i ‘/^GSSAPIAu/ s/yes/no/‘ /etc/ssh/sshd_config
sed -i ‘/^#UseDNS/ {s/^#//;s/yes/no}‘ /etc/ssh/sshd_config
id mysql > /dev/null
if [ $? -eq 0 ];then
echo "mysql user exist"
else
groupadd mysql
useradd -M -s /sbin/nologin mysql -g mysql
fi
if [ ! -d /usr/local/mysqld ];then
tar xf mysql-5.7.26-bin.tar.xz -C /usr/local/
chown mysql.mysql /usr/local/mysqld/ -R
fi
echo "export PATH=$PATH:/usr/local/mysqld/mysql/bin" >> /etc/profile
source /etc/profile
cat > /etc/my.cnf <<EOF
[mysqld]
basedir = /usr/local/mysqld/mysql
datadir = /usr/local/mysqld/data
tmpdir = /usr/local/mysqld/tmp
socket = /usr/local/mysqld/tmp/mysql.sock
pid_file = /usr/local/mysqld/tmp/mysqld.pid
log_error = /usr/local/mysqld/log/mysql_error.log
slow_query_log_file = /usr/local/mysqld/log/slow_warn.log
user = mysql
port = 3306
bind-address = 0.0.0.0
character-set-server = utf8
default_storage_engine = InnoDB
EOF
ln -s /usr/local/mysqld/mysql/support-files/mysql.server /usr/bin/mysqldctl
mysqldctl start
ln -s /usr/local/mysqld/tmp/mysql.sock /tmp/mysql.sock
mysqldctl restart
sed -i ‘/\[mysqld]/ a skip-grant-tables‘ /etc/my.cnf
mysqldctl restart
mysql <<EOF
update mysql.user set authentication_string=‘‘ where user=‘root‘ and Host=‘localhost‘;
flush privileges;
EOF
sed -i ‘/skip-grant/d‘ /etc/my.cnf
mysqldctl restart
yum -y install expect ntp
cat > /etc/ntp.conf << EOF
restrict default nomodify
server 127.127.1.0
fudge 127.127.1.0 stratum 10
EOF
systemctl start ntpd ; systemctl enable ntpd
expect <<-EOF
spawn mysqladmin -uroot -p password "ZHOUjian.20"
expect {
"password" { send "\r" }
}
expect eof
EOF
mysqldctl restart
}
Deplay
标签:dep llb soc ini 机制 hdfs path l数据库 help
原文地址:https://www.cnblogs.com/you-men/p/12838133.html