8.15-配置mysql5.7环境+使用python管理数据库+使用中间件mycat配置读写分离

news2024/11/16 3:45:45

一、配置mysql5.7的环境

1.基础配置

# 将mysql5.7的包拖入xshell
[root@mysql_5 ~]# ls
anaconda-ks.cfg  mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz
​
#  解压
[root@mysql_5 ~]# tar -xf mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz 
​
# 备份文件
[root@mysql_5 ~]# cp -r mysql-5.7.44-linux-glibc2.12-x86_64 /usr/local/mysql
​
# 删除文件
[root@mysql_5 ~]# rm -rf /etc/my.cnf
​
# 创建mysql目录
[root@mysql_5 ~]# mkdir /usr/local/mysql/mysql-files
​
# 创建用户
[root@mysql_5 ~]# useradd -r -s /sbin/nologin mysql
​
# 修改属主和属组
[root@mysql_5 ~]# chown mysql:mysql /usr/local/mysql/mysql-files/
​
# 修改权限
[root@mysql_5 ~]# chown 750 /usr/local/mysql/mysql-files/
​
# 初始化
[root@mysql_5 ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql
2024-08-15T02:45:14.516552Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2024-08-15T02:45:14.667185Z 0 [Warning] InnoDB: New log files created, LSN=45790
2024-08-15T02:45:14.702443Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2024-08-15T02:45:14.760234Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 663a18b9-5ab0-11ef-a23c-000c29962445.
2024-08-15T02:45:14.761289Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2024-08-15T02:45:15.341756Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2024-08-15T02:45:15.341774Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2024-08-15T02:45:15.343472Z 0 [Warning] CA certificate ca.pem is self signed.
2024-08-15T02:45:15.478916Z 1 [Note] A temporary password is generated for root@localhost: Usd!cwgSr6A#
​
# 其他配置
[root@mysql_5 ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql57
​
# 启动服务
[root@mysql_5 ~]# service mysql57 start
Starting MySQL.Logging to '/usr/local/mysql/data/mysql_5.7.err'.
 SUCCESS! 
 
 # 修改配置文件
[root@mysql_5 ~]# vim /usr/local/mysql/my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock
port=3306
log-error=/usr/local/mysql/data/db01-master.err
log-bin=/usr/local/mysql/data/binlog
server-id=10
character_set_server=utf8mb4
​
# 重新启动服务
[root@mysql_5 ~]# service mysql57 restart
Shutting down MySQL.. SUCCESS! 
Starting MySQL.Logging to '/usr/local/mysql/data/db01-master.err'.
 SUCCESS! 

2.登录mysql

# 登录
[root@mysql_5 ~]# /usr/local/mysql/bin/mysql -p
Enter password:Usd!cwgSr6A#
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.44
​
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
​
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
​
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
​
# 修改密码
mysql> alter user 'root'@'localhost' identified by 'root';
Query OK, 0 rows affected (0.00 sec)
​
# 创建新账户haha
mysql> create user 'haha'@'%' identified by 'haha';
Query OK, 0 rows affected (0.00 sec)
​
# 给权限
mysql> grant all on *.* to 'haha'@'%';
Query OK, 0 rows affected (0.00 sec)
​
# 刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
​
# 创建数据库
mysql> create database if not exists test charset utf8mb4;
Query OK, 1 row affected (0.00 sec)
​
# 使用数据库
mysql> use test;
Database changed
​
# 创建表
mysql> create table user(id int primary key auto_increment,username varchar(45) not null,password varchar(45) not null);
Query OK, 0 rows affected (0.01 sec)
​
# 给表中插入数据
mysql> insert into user (username,password)values("aaa","aaa");
Query OK, 1 row affected (0.00 sec)
​
# 查看表
mysql> select * from user;
+----+----------+----------+
| id | username | password |
+----+----------+----------+
|  1 | aaa      | aaa      |
+----+----------+----------+
1 row in set (0.00 sec)
​
mysql> select host,user from mysql.user;
+-----------+---------------+
| host      | user          |
+-----------+---------------+
| %         | haha          |
| %         | slave0        |
| localhost | mysql.session |
| localhost | mysql.sys     |
| localhost | root          |
+-----------+---------------+
5 rows in set (0.00 sec)

二、使用python管理数据库

1.python

# 建立数据库连接
>>> conn=pymysql.connect(host="192.168.2.57",port=3306,database="test",user="haha",password="haha")
​
# 创建游标对象
>>> cursor=conn.cursor()
​
# 创建用户
>>> cursor.execute("create user 'slave0'@'%' identified by 'slave0'")
0
​
# 给slave用户给权限(不能执行,因为haha账户没有权限给slave权限,所以会报错)
>>> cursor.execute("grant replication slave on *.* to 'slave0'@'%'")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
  File "/usr/local/lib/python3.6/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 775, in _read_query_result
    result.read()
  File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 1156, in read
    first_packet = self.connection._read_packet()
  File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "/usr/local/lib/python3.6/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "/usr/local/lib/python3.6/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, "Access denied for user 'haha'@'%' (using password: YES)")
>>> 

2.数据库

# 修改root权限,允许root远程登录
mysql> update mysql.user set host='%' where user='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0
​
# 刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

3.python

# 在python中使用root账户登录
​
# 建立连接
>>> 
conn=pymysql.connect(host="192.168.2.57",port=3306,database="test",user="root",password="root")
​
# 创建游标对象
>>> cursor=conn.cursor()
​
# 给slave0账户给权限
>>> cursor.execute("grant replication slave on *.* to 'slave0'@'%'")
0

4.在python中进行锁表

# 锁表
>>> cursor.execute("flush table with read lock")
0
​
# 锁表后,在MySQL中插入数据,不能创建,一直卡在插入数据的那里,插不进去,一旦解锁,MySQL中插入数据的这条语句就会立马执行成功
​
# 解锁
>>> cursor.execute("unlock tables")

5.数据库

# 在数据库中插入数据
mysql> insert into user (username,password)values('bbbb','bbbbb');
Query OK, 1 row affected (23.77 sec)

6.python

# 使用python查询mysql的状态信息
​
# 建立连接
>>> conn=pymysql.connect(host="192.168.2.57",port=3306,database="test",user="root",password="root")
​
# 创建游标对象
>>> cursor=conn.cursor()
​
# 执行查询数据库的语句
>>> cursor.execute("show master status")
1
​
# 将查到的语句进行打印
>>> print(cursor.fetchall())
(('binlog.000001', 154, '', '', ''),)
​
​
# 补充
​
# 查看状态信息,查到是空的话是因为没有写/usr/local/mysql/my.cnf配置文件
>>> cursor.execute("show master status")
0
>>> print(cursor.fetchall())
()

7.使用python自动化管理数据库

import pymysql
conn=pymysql.connect(host="10.1.1.15",port=3306,database="test",user="root",password="root");
cursor=conn.cursor()
cursor.execute("create user 'slave2'@'%' identified by 'slave2'")
cursor.execute("grant replication slave on *.*  to 'slave2'@'%'")
cursor.execute("flush privileges")
cursor.execute("flush tables with read lock")
cursor.execute("show master status")
print(cursor.fetchall())
​
isOk=input("slave server ok? y/n")
​
if isOK=='y':
    cursor.execute("unlock tables")

三、配置主从数据库

搭建从数据库(mysql5.7版本)

[root@slave_5 ~]# ls
anaconda-ks.cfg  mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz
​
# 解压
[root@slave_5 ~]# tar -xf mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz
​
# 备份文件
[root@slave_5 ~]# cp -r mysql-5.7.44-linux-glibc2.12-x86_64 /usr/local/mysql
​
# 删除文件
[root@slave_5 ~]# rm -rf /etc/my.cnf
​
# 创建目录
[root@slave_5 ~]# mkdir /usr/local/mysql/mysql-files
​
# 创建用户
[root@slave_5 ~]# useradd -r -s /sbin/nologin mysql
​
# 修改属主和属组
[root@slave_5 ~]# chown mysql:mysql /usr/local/mysql/mysql-files/
​
# 修改权限
[root@slave_5 ~]# chown 750 /usr/local/mysql/mysql-files/
​
# 停止服务(主数据库)
[root@mysql_5 ~]# service mysql57 stop
​
# 删除data中的auto.cnf(主数据库)
[root@mysql_5 ~]# rm -rf /usr/local/mysql/data/auto.cnf
​
# 将主数据库的data同步到从数据库中
[root@mysql_5 ~]# rsync -av /usr/local/mysql/data root@192.168.2.58:/usr/local/mysql/
​
# 修改配置文件(从数据库)
[root@slave_5 ~]# vim /usr/local/mysql/my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock
port=3310
log-error=/usr/local/mysql/data/err.log
relay-log=/usr/local/mysql/data/relaylog
character_set_server=utf8mb4
server-id=11
​
# 其他配置
[root@slave_5 ~]# cp /usr/local/mysql/support-files/mysql.server  /etc/init.d/mysql57
​
# 配置环境变量
[root@slave_5 ~]# sed -i '$aexport PATH=$PATH:/usr/local/mysql/bin' /etc/profile
[root@slave_5 ~]# sed -n '$p' /etc/profile
export PATH=$PATH:/usr/local/mysql/bin
[root@slave_5 ~]# source /etc/profile
​
# 设置开机自启
[root@slave_5 ~]# chkconfig --add mysql57
[root@slave_5 ~]# chkconfig  mysql57 on
[root@slave_5 ~]# service mysql57 start
Starting MySQL.Logging to '/usr/local/mysql/data/err.log'.
 SUCCESS! 
 
# 登录root账户
[root@slave_5 ~]# mysql -uroot -pHui@2003
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
​
# 登录root账户(主数据库)
[root@mysql_5 ~]# mysql -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.44-log MySQL Community Server (GPL)
​
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
​
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
​
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
​
# 锁表
mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)
​
# 查看master状态信息
mysql> show master status;
+---------------+----------+--------------+------------------+-------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+------------------+-------------------+
| binlog.000002 |      154 |              |                  |                   |
+---------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
​
​
# 登录root用户(从数据库)
[root@slave_5 ~]# mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.44 MySQL Community Server (GPL)
​
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
​
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
​
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
​
# 配置change master to(从数据库)
mysql> change master to master_host="192.168.2.57",master_user="slave0",master_passworrd="slave0",master_log_file="binlog.000002",master_log_pos=154;
Query OK, 0 rows affected, 2 warnings (0.01 sec)
​
# 启动slave
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
​
# 查看主从配置详细信息
mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.2.57
                  Master_User: slave0
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000002
          Read_Master_Log_Pos: 154
               Relay_Log_File: relaylog.000002
                Relay_Log_Pos: 317
        Relay_Master_Log_File: binlog.000002
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
​
# 主数据库
​
# 解锁
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)
​
# 插入数据
mysql> insert into test.user (username,password)values('xxxxx','xxxxx');
Query OK, 1 row affected (0.03 sec)
          
# 从数据库
​
# 数据已经同步
mysql> select * from test.user;
+----+----------+----------+
| id | username | password |
+----+----------+----------+
|  1 | aaa      | aaa      |
|  2 | bbbb     | bbbbb    |
|  3 | xxxxx    | xxxxx    |
+----+----------+----------+
3 rows in set (0.00 sec)
​

四、配置读写分离(中间件)

读写分离的配置文件:

文件名称作用
server.xml配置mycat的对外的用户、密码、映射数据库名称等信息
schema.xml配置后端真实有效的用户、密码、真实数据库名称等信息

1.添加一个新的虚拟主机

设置ip为192.168.2.59,主机名为mycat

2.上传jdk和mycat包

[root@mycat ~]# ls
anaconda-ks.cfg             Mycat-server-1.6.5-release-20180122220033-linux.tar.gz
jdk-8u192-linux-x64.tar.gz

3.解压

# 解压
[root@mycat ~]# tar -xf jdk-8u192-linux-x64.tar.gz 
[root@mycat ~]# tar -xf Mycat-server-1.6.5-release-20180122220033-linux.tar.gz 
[root@mycat ~]# ls
anaconda-ks.cfg             mycat
jdk1.8.0_192                Mycat-server-1.6.5-release-20180122220033-linux.tar.gz
jdk-8u192-linux-x64.tar.gz
[root@mycat ~]# cp -r jdk1.8.0_192/ /usr/local/jdk
[root@mycat ~]# cp -r mycat/ /usr/local/

4.配置环境变量

[root@mycat ~]# ls /usr/local/jdk/
bin             lib          src.zip
COPYRIGHT       LICENSE      THIRDPARTYLICENSEREADME-JAVAFX.txt
include         man          THIRDPARTYLICENSEREADME.txt
javafx-src.zip  README.html
jre             release
[root@mycat ~]# sed -i '$aexport JAVA_HOME=/usr/local/jdk' /etc/profile
[root@mycat ~]# source /etc/profile
[root@mycat ~]# $JAVA_HOME 
-bash: /usr/local/jdk: 是一个目录
[root@mycat ~]# sed -i '$aexport PATH=$PATH:$JAVA_HOME/bin' /etc/profile
[root@mycat ~]# source /etc/profile
[root@mycat ~]# $PATH
-bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/jdk/bin: 没有那个文件或目录

5.查看版本

[root@mycat ~]# javac -version
javac 1.8.0_192

6.测试mycat启动

[root@mycat ~]# ls /usr/local/mycat/
bin  catlet  conf  lib  logs  version.txt
[root@mycat ~]# ll /usr/local/mycat/
总用量 12
drwxr-xr-x. 2 root root  190 8月  15 15:18 bin
drwxr-xr-x. 2 root root    6 8月  15 15:18 catlet
drwxr-xr-x. 4 root root 4096 8月  15 15:18 conf
drwxr-xr-x. 2 root root 4096 8月  15 15:18 lib
drwxr-xr-x. 2 root root    6 8月  15 15:18 logs
-rwxr-xr-x. 1 root root  219 8月  15 15:18 version.txt
[root@mycat ~]# ls /usr/local/mycat/bin/
dataMigrate.sh   mycat      startup_nowrap.sh     wrapper-linux-x86-32
init_zk_data.sh  rehash.sh  wrapper-linux-ppc-64  wrapper-linux-x86-64
​
# 成功启动
[root@mycat ~]# /usr/local/mycat/bin/mycat console
Running Mycat-server...
wrapper  | --> Wrapper Started as Console
wrapper  | Launching a JVM...
jvm 1    | Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=64M; support was removed in 8.0
jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    | 
jvm 1    | log4j:WARN No appenders could be found for logger (io.mycat.memory.MyCatMemory).
jvm 1    | log4j:WARN Please initialize the log4j system properly.
jvm 1    | log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
jvm 1    | MyCAT Server startup successfully. see logs in logs/mycat.log

7.找到server.xml和scheme.xml文件

[root@mycat ~]# ls /usr/local/mycat/conf/
autopartition-long.txt       rule.xml
auto-sharding-long.txt       schema.xml
auto-sharding-rang-mod.txt   sequence_conf.properties
cacheservice.properties      sequence_db_conf.properties
dbseq.sql                    sequence_distributed_conf.properties
ehcache.xml                  sequence_time_conf.properties
index_to_charset.properties  server.xml
log4j2.xml                   sharding-by-enum.txt
migrateTables.properties     wrapper.conf
myid.properties              zkconf
partition-hash-int.txt       zkdownload
partition-range-mod.txt

8.配置server.xml

[root@mycat ~]# vim /usr/local/mycat/conf/server.xml 
​
 93         <user name="zzz" defaultAccount="true">
 94                 <property name="password">zzz</property>
 95                 <property name="schemas">test</property>
​
​
107 <!--
108         <user name="user">
109                 <property name="password">user</property>
110                 <property name="schemas">TESTDB</property>
111                 <property name="readOnly">true</property>
112         </user>
113 -->
​

9.配置schema.xml文件

[root@mycat ~]# vim /usr/local/mycat/conf/schema.xml
​
  1 <?xml version="1.0"?>
  2 <!DOCTYPE mycat:schema SYSTEM "schema.dtd">
  3 <mycat:schema xmlns:mycat="http://io.mycat/">
  4         <!--1.名称为真的是数据库名称,添加dataNode 指定名称-->
  5         <schema name="test" dataNode="dn1" checkSQLschema="false" sqlMaxLimit="100">
  6         </schema>
  7         <!-- <dataNode name="dn1$0-743" dataHost="localhost1" database="db$0-743"
  8                 /> -->
  9         <dataNode name="dn1" dataHost="localhost1" database="test" />
 10 <!--    <dataNode name="dn2" dataHost="localhost1" database="db2" />
 11         <dataNode name="dn3" dataHost="localhost1" database="db3" /> -->
 12         <!--<dataNode name="dn4" dataHost="sequoiadb1" database="SAMPLE" />
 13          <dataNode name="jdbc_dn1" dataHost="jdbchost" database="db1" />
 14         <dataNode       name="jdbc_dn2" dataHost="jdbchost" database="db2" />
 15         <dataNode name="jdbc_dn3"       dataHost="jdbchost" database="db3" /> -->
 16         <dataHost name="localhost1" maxCon="1000" minCon="10" balance="0"
 17                           writeType="0" dbType="mysql" dbDriver="native" switchType="1"  slaveThreshold="100">
 18                 <heartbeat>select user()</heartbeat>
 19                 <!-- can have multi write hosts -->
 20                 <writeHost host="hostM1" url="192.168.2.57:3306" user="zzz"
 21                                    password="zzz">
 22                         <!-- can have multi read hosts -->
 23                         <readHost host="hostS2" url="192.168.2.58:3310" user="zzz" password="zzz" />
 24                 </writeHost>
 25         </dataHost>
​

10.启动服务

# 启动服务
[root@mycat ~]# /usr/local/mycat/bin/mycat start
Starting Mycat-server...
​
# 查看端口(有端口就是启动成功了)
[root@mycat ~]# netstat -lntup | grep 8066
tcp6       0      0 :::8066                 :::*                    LISTEN            
​
# 补充(报错的话查看错误日志)
[root@mycat ~]# vim /usr/local/mycat/logs/wrapper.log .
还有 2 个文件等待编辑

五、测试mycat

1.客户端

[root@client bin]# ./mysql -h192.168.2.59 -P8066 -uzzz -pzzz
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.29-mycat-1.6.5-release-20180122220033 MyCat Server (OpenCloundDB)
​
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
​
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
​
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
​
mysql> show databases;
+----------+
| DATABASE |
+----------+
| test     |
+----------+
1 row in set (0.01 sec)
​
mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
​
Database changed
mysql> select * from user;
+----+----------+----------+
| id | username | password |
+----+----------+----------+
|  1 | aaa      | aaa      |
|  2 | bbbb     | bbbbb    |
|  3 | xxxxx    | xxxxx    |
+----+----------+----------+
3 rows in set (0.02 sec)
​
mysql> show variables like "server_id";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 10    |
+---------------+-------+
1 row in set (0.01 sec)
​
mysql> 

2.远程工具登录

在Navicat中登录查看表中的数据:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2043257.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

短说V4.2.0测试版发布|字体更换、小名片及个人中心UI更换

Hi 大家好&#xff0c; 我是给你们带来惊喜的运营小番茄。 本期更新为短说V4.2.0测试版&#xff0c;本次更新涉及平台有H5、App、微信小程序。 4.2.0版本除功能优化外&#xff0c;新增了如下功能&#xff1a; 一、新增功能 通用版&#xff1a; ①全站默认字体全部更换为…

淘宝到一个墨水屏,成功实现显示经历记录

一&#xff0c;淘一个墨水屏的原因 在一些小的PCB设计和编程中发现&#xff0c;许多程序控制运行情况如果能够显示出来&#xff0c;会很完美。大学时期使用LCD1602&#xff08;经典&#xff09;显示了一个称重传感器的课程设计&#xff0c;后来尝试OLED显示。在过程中发现墨水…

【嵌入式linux开发】智能家居入门5(QT、微信小程序、HTTP协议、ONENET云平台、旭日x3派)

智能家居入门5&#xff08;QT、微信小程序、HTTP协议、ONENET云平台、旭日x3派&#xff09; 前言一、QT界面设计二、云平台产品创建与连接三、下位机端QT代码总览&#xff1a;四、微信小程序端代码总览五、板端测试 前言 前四篇智能家居相关文章都是使用STM32作为主控&#xf…

报表的多行业应用!用工具做报表省了我不少事...

一、什么是报表&#xff1f; 说起报表&#xff0c;你不会还停留在Excel报表的层面上吧&#xff1f; 传统的报表一般都是基于Excel制作的&#xff0c;主要面向业务人员、开发人员等&#xff0c;也有一些公司会自己去开发设计&#xff0c;只不过周期较长&#xff0c;耗费人力多。…

端到端自动驾驶落地挑战与驱动力

1、端到端的发展驱动力 1.1 对标驱动&#xff1a;特斯拉FSD的标杆作用吸引行业关注 大部分行业专家表示&#xff0c;特斯拉FSD v12的优秀表现&#xff0c;是端到端自动驾驶这一技术路线快速形成大范围共识的最重要的推动力&#xff1b;而在此之前&#xff0c;从来没有一个自动…

C#模拟量线性变换小程序

1、一步步建立一个C#项目 一步步建立一个C#项目(连续读取S7-1200PLC数据)_s7协议批量读取-CSDN博客文章浏览阅读1.7k次,点赞2次,收藏4次。本文详细介绍了如何使用C#构建一个项目,通过S7net库连接并连续读取S7-1200 PLC的数据,包括创建窗体应用、配置存储位置、安装S7net库…

服务器端请求伪造漏洞

1.客户端请求 客户端请求指的是由客户端设备(如个人计算机、智能手机、平板电脑等)或软件(浏览器、各种APP)发出的请求&#xff0c;以获取指定的网页、图片、视频或其他资源。比如当用户在浏览器中输入URL或点击链接时&#xff0c;浏览器会自动发起HTTP请求&#xff0c;请求服…

Python | Leetcode Python题解之第335题路径交叉

题目&#xff1a; 题解&#xff1a; class Solution:def isSelfCrossing(self, distance: List[int]) -> bool:n len(distance)# 处理第 1 种情况i 0while i < n and (i < 2 or distance[i] > distance[i - 2]):i 1if i n:return False# 处理第 j 次移动的情况…

【语义通信】灵(Genie)——6G的第四维元素

6G 不仅包含 5G 涉及的人类社会、信息空间、 物理世界&#xff08;人、机、物&#xff09;这 3 个核心元素&#xff0c;还第四维元素—灵&#xff08;Genie&#xff09;。Genie存在于虚拟世界体系&#xff0c;虚拟世界体系包括&#xff08;VPS, VBS, VSS&#xff09;&#xff0…

BvSP_ Broad-view Soft Prompting for Few-Shot Aspect Sentiment Quad Prediction

中文题目: 英文题目: BvSP: Broad-view Soft Prompting for Few-Shot Aspect Sentiment Quad Prediction 论文地址: aclanthology.org/2024.acl-long.460.pdf 代码地址: https://github.com/byinhao/BvSP 论文级别&#xff0c; 单位: (2024 ACL long paper) 南开大学&#xff0…

写给大数据开发:如何解决拖延

你是否曾面对一个复杂的Spark任务&#xff0c;明知它对项目至关重要&#xff0c;却总是找各种理由推迟动手&#xff1f;或者&#xff0c;你有没有在面对一堆待优化的Hive查询时&#xff0c;选择先去重构那个"并不那么紧急"的Python脚本&#xff1f; 如果你点头了&am…

faceswap安装

目录 简介下载地址安装clone代码安装conda配置和安装 启动其他 简介 Faceswap 是领先的免费开源多平台 Deepfakes 软件。由 Tensorflow、Keras 和 Python 提供支持&#xff1b;Faceswap 将在 Windows、macOS 和 Linux 上运行。支持CPU运行&#xff0c;无独显也能跑。 下载地址…

language model

1、language model&#xff08;LM&#xff09;&#xff1a;估计token序列的可能性 2、对于HMM&#xff0c;固定需要P(Y)才符合公式&#xff1b;对于LAS&#xff0c;加上P(Y)能够使效果更好 P(Y|X)需要成对的数据&#xff0c;而P(Y)不需要成对&#xff0c;所以可以得到很多数据 …

Git使用教程介绍 - 1.Git 起因和背景

对于git的整体运作体系和更多的基本操作和概念并不是非常熟悉&#xff0c;因此恶补一番&#xff0c;把自己的成果和理解整理为一个git使用系列。 我也会不断更新该系列&#xff0c;与大家共勉&#xff0c;也是自我学习迭代的过程。 更多技术文章&#xff0c;全网首发公众号 “…

pytorch库 05 PyTorch深度学习实践笔记

文章目录 一、基本概念1、深度学习流程2、感知机结构与人工神经网络结构3、反向传播&#xff08;Back Propagation&#xff09;导学 二、线性模型1、线性模型计算流程2、代码实现3、小练习 三、梯度下降算法1、梯度下降计算流程2、代码实现3、随机梯度下降&#xff08;SGD&…

你还纠结996吗?2024年互联网公司工作时长排行榜出炉!

2024年互联网公司工作时长排行榜新鲜出炉&#xff01;在这个竞争激烈的行业中&#xff0c;工作时长一直是人们关注的热点话题。你还在纠结996工作制吗&#xff1f;也许这份排行榜会给你一些意想不到的答案。 为什么一些公司依旧推行996&#xff0c;而另一些公司却在努力减少员…

驾考流程不清晰?教练精心整理,学车速看!(建议收藏)

驾考流程太复杂&#xff1f;不知道报名之后要怎么做&#xff1f;看这一篇给你把驾考流程说通透&#xff01; 第1步 驾校报名 建议从驾校的规模、收费、教练水平、合格率等方面综合考虑&#xff0c;选择一个适合自己的驾校&#xff0c;携带个人身份证进行缴费报名。 第2步 体检…

C++:map And set

1. 关联式容器 在初阶阶段&#xff0c;我们已经接触过STL中的部分容器&#xff0c;比如&#xff1a;vector、list、deque、forward_list(C11)等&#xff0c;这些容器统称为序列式容器&#xff0c;因为其底层为线性序列的数据结构&#xff0c;里面存储的是元素本身。那什么是关联…

深入理解Java虚拟机(内存区域)

文章收录在网站&#xff1a;http://hardyfish.top/ 文章收录在网站&#xff1a;http://hardyfish.top/ 文章收录在网站&#xff1a;http://hardyfish.top/ 文章收录在网站&#xff1a;http://hardyfish.top/ 内存区域 运行时数据区域 Java虚拟机在执行Java程序的过程中会把它…

haproxy的工具及其算法

一、socat 工具 dnf install socat -y #查看帮助文档 echo "help" | socat stdio /var/lib/haproxy/stats #查看参数 echo "show info" | socat stdio /var/lib/haproxy/stats #查看服务状态 echo "show servers state" | socat stdio /var/lib/…