前端技术
HTML
CSS
Javascript
前端框架和UI库
VUE
ReactJS
AngularJS
JQuery
NodeJS
JSON
Element-UI
Bootstrap
Material UI
服务端和客户端
Java
Python
PHP
Golang
Scala
Kotlin
Groovy
Ruby
Lua
.net
c#
c++
后端WEB和工程框架
SpringBoot
SpringCloud
Struts2
MyBatis
Hibernate
Tornado
Beego
Go-Spring
Go Gin
Go Iris
Dubbo
HessianRPC
Maven
Gradle
数据库
MySQL
Oracle
Mongo
中间件与web容器
Redis
MemCache
Etcd
Cassandra
Kafka
RabbitMQ
RocketMQ
ActiveMQ
Nacos
Consul
Tomcat
Nginx
Netty
大数据技术
Hive
Impala
ClickHouse
DorisDB
Greenplum
PostgreSQL
HBase
Kylin
Hadoop
Apache Pig
ZooKeeper
SeaTunnel
Sqoop
Datax
Flink
Spark
Mahout
数据搜索与日志
ElasticSearch
Apache Lucene
Apache Solr
Kibana
Logstash
数据可视化与OLAP
Apache Atlas
Superset
Saiku
Tesseract
系统与容器
Linux
Shell
Docker
Kubernetes
[mysqli_connect函数]的搜索结果
这里是文章列表。热门标签的颜色随机变换,标签颜色没有特殊含义。
点击某个标签可搜索标签相关的文章。
点击某个标签可搜索标签相关的文章。
MySQL
...称 $conn = mysqli_connect($host, $user, $password, $database); // 检测连接是否成功 if (!$conn) { die('连接不成功: ' . mysqli_connect_error()); } // 查询数据 $sql = 'SELECT FROM user'; $result = mysqli_query($conn, $sql); // 处理查询结果 if (mysqli_num_rows($result) >0) { while ($row = mysqli_fetch_assoc($result)) { echo '账号: ' . $row['username'] . ', 口令: ' . $row['password'] . ' '; } } else { echo '没有结果'; } // 关闭连接 mysqli_close($conn); 常规连接的代码比较简单,用mysqli_connect()函数连接MySQL服务器,然后用mysqli_query()函数执行查询,最后用mysqli_fetch_assoc()函数处理查询结果。这种连接方式适用于在本地开发和测试。 SSH连接: // 连接MySQL服务器 $host = 'localhost'; // 主机名 $user = 'root'; // 账号 $password = '123456'; // 口令 $database = 'test'; // 数据库名称 // SSH设置 $ssh_host = 'ssh.example.com'; // SSH主机名 $ssh_user = 'sshuser'; // SSH账号 $ssh_password = 'sshpassword'; // SSH口令 $ssh_port = 22; // SSH端口 // SSH到MySQL服务器 $connection = ssh2_connect($ssh_host, $ssh_port); if (ssh2_auth_password($connection, $ssh_user, $ssh_password)) { // SSH认证成功 $tunnel = ssh2_tunnel($connection, $host, 3306); // 连接MySQL服务器 $conn = mysqli_connect('127.0.0.1', $user, $password, $database, '3306', $tunnel); // 检测连接是否成功 if (!$conn) { die('连接不成功: ' . mysqli_connect_error()); } // 查询数据 $sql = 'SELECT FROM user'; $result = mysqli_query($conn, $sql); // 处理查询结果 if (mysqli_num_rows($result) >0) { while ($row = mysqli_fetch_assoc($result)) { echo '账号: ' . $row['username'] . ', 口令: ' . $row['password'] . ' '; } } else { echo '没有结果'; } // 关闭连接 mysqli_close($conn); } else { // SSH认证不成功 die('SSH认证不成功'); } SSH连接的代码相对复杂,需要用ssh2_connect()函数连接SSH服务器,用ssh2_auth_password()函数进行SSH认证,然后用ssh2_tunnel()函数创建隧道,最后用mysqli_connect()函数连接MySQL服务器和数据库。SSH连接的好处是可以通过SSH隧道连接到远程的MySQL服务器,提升了数据传输的安全性。
2023-06-22 12:09:56
134
码农
MySQL
...: $conn = mysqli_connect("localhost", "username", "password", "dbname"); if (!$conn) { die("接入失败: " . mysqli_connect_error()); } 其中,localhost指接入的服务器地址,username和password分别指接入的账号和口令,dbname指接入的数据库实例。 接下来,我们需要创建执行语句,以往数据库里添加记录。简单的执行语句可以采用下面的模板: INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...); 其中,table_name指要添加记录的表格名称,column1,column2,column3, ...分别指要添加记录的字段名称,value1,value2,value3, ...分别指要添加记录的数据项。 此处为一个添加记录的示例: $sql = "INSERT INTO students (name, age, gender, class) VALUES ('张三', 18, '男', '一班')"; if (mysqli_query($conn, $sql)) { echo "新条目成功添加"; } else { echo "错误信息: " . $sql . " " . mysqli_error($conn); } 其中,students指要添加记录的表格名称,name、age、gender、class分别指要添加记录的字段名称,后面的数据项分别为'张三'、18、'男'、'一班'。 最后,我们需要关闭接入: mysqli_close($conn); 通过上面的步骤,我们可以在MySQL中往明确字段里写入数据。
2023-06-05 22:29:31
72
算法侠
MySQL
...存在,那么你可以使用mysqli_select_db()函数在PHP中验证。下面是一个例子: $host = 'localhost'; $user = 'root'; $password = 'password'; $database_name = 'database_name'; $link = mysqli_connect($host,$user,$password); if (!$link) { die('连接错误: ' . mysqli_error()); } $db_selected = mysqli_select_db($link, $database_name); if (!$db_selected) { die ('不能使用 $database_name : ' . mysqli_error()); } 如果$db_selected返回为真,就意味着数据库存在,否则数据库不存在。 总结 现在你已经知道了三种验证MySQL数据库是否存在的方法,这将帮助你更好的管理和操作MySQL数据库。
2023-01-14 14:51:54
105
代码侠
MySQL
...的一致性和完整性。 mysqli_connect函数 , 在PHP编程语言中,mysqli_connect是一个内置函数,用于连接到MySQL服务器并打开一个数据库连接。该函数接收四个参数,分别是MySQL服务器的地址、数据库用户名、密码以及要连接的数据库名。成功连接后返回一个连接标识符,后续的SQL查询和数据操作都将通过这个连接标识符进行,如在文章中提到的执行查询、插入数据等任务。 INSERT INTO语句 , INSERT INTO是SQL语言中的命令,用于向指定的数据库表中插入新的数据行。在文中,INSERT INTO customers (name, email, phone) VALUES ( John Doe , johndoe@example.com , 555-555-5555 ) 这条语句将一条包含姓名、电子邮箱和电话号码的新客户记录添加到了名为“customers”的表中。每个括号内的字段名对应值后面的变量,确保数据被正确地插入到相应字段内。 mysqli_query函数 , 在PHP的MySQLi扩展中,mysqli_query函数用于执行一个SQL查询或命令。它可以处理SELECT、INSERT、UPDATE、DELETE等多种类型的SQL语句,并根据查询类型返回结果集或影响行数。在本文上下文中,mysqli_query函数不仅用于从“customers”表中选择所有记录,还用于执行INSERT INTO语句以插入新数据,并在插入后再次查询渲染新添加的数据。
2024-02-04 16:16:22
70
键盘勇士
MySQL
...our MySQL connection id is 100 Server version: 5.7.33 MySQL Community Server (GPL) 如果看到类似的输出,那就意味着MySQL正在运行,并且你已经成功登录。 四、步骤三 深入检查安装状态 1.4 确认安装细节 为了进一步验证,我们可以执行status命令,这将显示服务器的状态和版本信息: SHOW VARIABLES LIKE 'version'; 这段代码会返回你的MySQL服务器的具体版本号,确认安装是否正确。 五、步骤四 启动服务的另一种方式 1.5 刷新记忆:服务视角 有时候,我们可能想要通过操作系统的服务管理器来检查MySQL是否作为服务正在运行。在Windows上,可以输入: powershell sc query mysql 在Linux或macOS中,使用systemctl status mysql或service mysql status。 六、代码片段 连接与断开 1.6 实战演练:连接失败的警示 为了展示连接不成功的场景,假设连接失败,你可能会看到类似这样的错误: php $conn = mysqli_connect('localhost', 'root', 'password'); if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } 如果代码中mysqli_connect_error()返回非空字符串,那就意味着连接有问题。 七、结论 建立信任关系 通过以上步骤,你应该能够确定MySQL是否已经成功安装并运行。记住了啊,每当你要开始新的项目或者打算调整系统设置的时候,一定要记得这个重点,因为一个健健康康的数据库,那可是任何应用程序运行的命脉所在啊,就像人的心脏一样重要。要是你碰到啥问题,千万记得翻翻MySQL的官方宝典,或者去社区里找大伙儿帮忙。那儿可有一大群身经百战的老骑士们,他们绝对能给你提供靠谱的指导! 在你的编程旅程中,MySQL的安装和管理只是开始,随着你对其掌握的加深,你将能驾驭更多的高级特性,让数据安全而高效地流淌。祝你在数据库管理的征途上马到成功!
2024-03-08 11:25:52
117
昨夜星辰昨夜风-t
MySQL
...名 $conn = mysqli_connect($db_host, $db_user, $db_pass, $db_name); if (!$conn) { die("连接错误:" . mysqli_connect_error()); } 连接成功后,我们可以将数据传输到MySQL数据库中。将以下PHP代码放到您的脚本中: $sql = "CREATE TABLE test ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, name VARCHAR(30) NOT NULL, email VARCHAR(50) NOT NULL, reg_date TIMESTAMP )"; if (mysqli_query($conn, $sql)) { echo "数据表test创建成功"; } else { echo "创建数据表错误: " . mysqli_error($conn); } 以上代码将在您的MySQL数据库中创建名为test的数据表。该表包含id、name、email和reg_date列。id列将自动递增,并将作为主键。name和email列不能为NULL,而reg_date列将保存创建行的时间戳。 上传数据到MySQL数据库中可能需要一些额外的数据处理。您可以从CSV文件、文本文件、XML文件、JSON数据或通过表格收集的数据中读取数据,然后将其转换为MySQL可以处理的常规数据格式。使用以下PHP代码将数据上传到MySQL数据库中: $myfile = fopen("data.txt", "r") or die("不能打开文件!"); while (!feof($myfile)) { $line = fgets($myfile); $line_arr = explode(",", $line); $name = $line_arr[0]; $email = $line_arr[1]; $sql = "INSERT INTO test (name, email) VALUES ('$name', '$email')"; mysqli_query($conn, $sql); } fclose($myfile); echo "上传数据到MySQL数据库成功"; 以上代码将从文本文件中获取数据,并将其上传到MySQL数据库的test数据表中。请注意,我们将数据数组中的第一和第二个元素映射到MySQL表test中的name和email列。 当您上传或更新数据时,请记得在您的PHP脚本中使用适当的错误处理和安全措施,以确保数据库安全。
2024-01-19 14:50:17
333
数据库专家
VUE
...) { const connection = mysql.createConnection({ host: 'localhost', user: 'root', password: '123456', database: 'test' }); connection.connect(); connection.query('SELECT FROM users', (error, results, fields) =>{ if (error) throw error; this.users = results; }); connection.end(); } } 在上面的代码中,我们通过npm安装了mysql模块,并在Vue组件中使用了它。首先,我们创建了一个数据库连接connection,并传入数据库的参数。接着,我们执行了一次数据查询,得到了结果results,并将其关联到Vue组件的data中。最后,我们关闭了数据库连接connection。这样就完成了从MySQL数据库中读取数据,并且将其关联至Vue组件中。 总的来说,Vue和MySQL是两个非常重要的前端结构和关系型数据库,在实际开发中经常被使用。通过学习和掌握Vue和MySQL的使用方法,可以让我们更加快速地进行前端开发和数据存储。
2023-11-04 09:39:55
77
数据库专家
RabbitMQ
...sleep def connect_to_rabbitmq(): max_retries = 5 retry_delay = 5 seconds for i in range(max_retries): try: connection = pika.BlockingConnection(pika.ConnectionParameters('localhost')) print("成功连接到RabbitMQ") return connection except Exception as e: print(f"尝试{i+1}连接失败,将在{retry_delay}秒后重试...") sleep(retry_delay) print("多次重试后仍无法连接到RabbitMQ,程序将退出") exit(1) 调用函数尝试建立连接 connection = connect_to_rabbitmq() 3.2 实施断线重连策略 除了基本的重试机制外,我们还可以实现更复杂的断线重连策略。例如,当检测到连接异常时,立即尝试重新建立连接,并记录重连日志以便后续分析。另外,我们也可以试试用指数退避算法来调整重连的时间间隔,这样就不会在短时间内反复向服务器发起连接请求,也能让服务器稍微轻松一点。 下面展示了一个基于RabbitMQ官方客户端库pika的断线重连示例: python import pika from time import sleep class ReconnectingRabbitMQClient: def __init__(self, host='localhost'): self.host = host self.connection = None self.channel = None def connect(self): while True: try: self.connection = pika.BlockingConnection(pika.ConnectionParameters(self.host)) self.channel = self.connection.channel() print("成功连接到RabbitMQ") break except Exception as e: print(f"尝试连接失败,将在{2self.retry_count}秒后重试...") self.retry_count += 1 sleep(2self.retry_count) def close(self): if self.connection: self.connection.close() def send_message(self, message): if not self.channel: self.connect() self.channel.basic_publish(exchange='', routing_key='hello', body=message) client = ReconnectingRabbitMQClient() client.send_message('Hello World!') 在这个例子中,我们创建了一个ReconnectingRabbitMQClient类,它包含了连接、关闭连接以及发送消息的方法。特别要注意的是connect方法里的那个循环,这家伙每次连接失败后都会先歇一会儿,然后再杀回来试试看。而且这休息的时间也是越来越长,越往后重试间隔就按指数往上翻。 3.3 异步处理与心跳机制 对于那些需要长时间保持连接的应用场景,我们还可以采用异步处理方式,配合心跳机制来维持连接的有效性。心跳其实就是一种简单的保活方法,就像定时给对方发个信息或者挥挥手,确认一下对方还在不在。这样就能赶紧发现并搞定那些断掉的连接,免得因为放太长时间没动静而导致连接中断的问题。 4. 总结与展望 处理RabbitMQ中的连接故障是一项复杂但至关重要的任务。通过上面提到的几种招数——比如重试机制、断线重连和心跳监测,我们的系统会变得更强壮,也更靠谱了。当然,针对不同应用场景和需求,还需要进一步定制化和优化这些方案。比如说,对于那些对延迟特别敏感的应用,你得更仔细地调整重试策略,不然用户可能会觉得卡顿或者直接闪退。至于那些需要应对海量并发连接的场景嘛,你就得上点“硬货”了,比如用更牛的技术来搞定负载均衡和集群管理,这样才能保证系统稳如老狗。总而言之,就是咱们得不停地试啊试的,然后就能慢慢弄出个既快又稳的分布式消息传递系统。 --- 以上就是关于RabbitMQ中如何处理连接故障的一些探讨。希望这些内容能帮助你在实际工作中更好地应对挑战,打造更加可靠的应用程序。如果你有任何疑问或想要分享自己的经验,请随时留言讨论!
2024-12-02 16:11:51
94
红尘漫步
Scala
...给println函数。 3. 存在类型的实用场景 存在类型在实际编程中主要用于泛型容器的返回和匿名类型表达。特别是在捣鼓API设计的时候,当你想把那些复杂的实现细节藏起来,只亮出真正需要的接口给大伙儿用,这时候类型的作用就凸显出来了,简直不能更实用了。 例如,假设我们有一个工厂方法,它根据配置创建并返回不同类型的数据库连接: scala trait DatabaseConnection { def connect(): Unit def disconnect(): Unit } def createDatabaseConnection(config: Config): DatabaseConnection forSome { type T <: DatabaseConnection } = { // 根据config创建并返回一个具体的DatabaseConnection实现 // ... val connection: T = ... // 假设这里已经创建了某个具体类型的数据库连接 connection } val connection = createDatabaseConnection(myConfig) connection.connect() connection.disconnect() 在这里,使用者只需要知道createDatabaseConnection返回的是某种实现了DatabaseConnection接口的对象,而不必关心具体的实现类。 4. 对存在类型的思考与探讨 存在类型虽然强大,但使用时也需要谨慎。要是老这么使劲儿用,可能会把一些类型信息给整没了,这样一来,编译器就像个近视眼没戴眼镜,查不出代码里所有的类型毛病。这下可好,代码不仅读起来费劲多了,安全性也大打折扣,就像你走在满是坑洼的路上,一不小心就可能摔跟头。同时,对于过于复杂的类型系统,理解和调试也可能变得困难。 总的来说,Scala的存在类型就像是编程世界里的“薛定谔的猫”,它的具体类型取决于运行时的状态,这为我们提供了更加灵活的设计空间,但同时也要求我们具备更深厚的类型系统理解和良好的抽象思维能力。所以在实际动手开发的时候,咱们得看情况灵活应变,像聪明的狐狸一样权衡这个高级特性的优缺点,找准时机恰到好处地用起来。
2023-09-17 14:00:55
42
梦幻星空
RabbitMQ
...) { const connection = await amqp.connect('amqp://localhost'); const channel = await connection.createChannel(); // 创建一个HTTP Exchange await channel.exchangeDeclare( 'http_requests', // Exchange name 'topic', // Exchange type (HTTP requests use topic) { durable: false } // Durable exchanges are not needed for HTTP ); // 发送HTTP请求消息 const message = { routingKey: 'http.request.', // Match all HTTP requests body: JSON.stringify({ url }), }; await channel.publish('http_requests', message.routingKey, Buffer.from(JSON.stringify(message))); console.log(Published HTTP request to ${url}); await channel.close(); await connection.close(); } // 调用函数并发送请求 publishHttpMessage('https://example.com/api/v1'); 这种方式允许API Gateway接收来自客户端的HTTP请求,然后将这些请求转化为RabbitMQ的消息,进一步转发给后端处理服务。 4. gRPC集成 gRPC-RabbitMQ Bridge 对于gRPC,我们可能需要一个中间件桥接器,如grpc-gateway和protobuf-rpc。例如,gRPC客户端可以通过gRPC Gateway将请求转换为HTTP请求,然后由RabbitMQ处理。这里有一个简化版的伪代码示例: python from google.api import service_pb2_grpc from grpc_gateway import services_pb2, gateway class RabbitMQGrpcHandler(service_pb2_grpc.MyServiceServicer): def UnaryCall(self, request, context): Convert gRPC request to RabbitMQ message rabbit_message = services_pb2.MyRequestToProcess(request.to_dict()) Publish the message to RabbitMQ with channel: channel.basic_publish( exchange='gRPC_Requests', routing_key=rabbit_message.routing_key, body=json.dumps(rabbit_message), properties=pika.BasicProperties(content_type='application/json') ) Return a response or acknowledge the call return services_pb2.MyResponse(status="Accepted") Start the gRPC server with the RabbitMQ handler server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) service_pb2_grpc.add_MyServiceServicer_to_server(RabbitMQGrpcHandler(), server) server.add_insecure_port('[::]:50051') server.start() 这样,gRPC客户端发出的请求经过gRPC Gateway的适配,最终被RabbitMQ处理,实现异步解耦。 5. 特点和应用场景 - 灵活性:HTTP和gRPC集成使得RabbitMQ能够适应各种服务间的通信需求,无论是API网关、微服务架构还是跨语言通信。 - 解耦:生产者和消费者不需要知道对方的存在,提高了系统的可维护性和扩展性。 - 扩展性:RabbitMQ的集群模式允许在高并发场景下轻松扩展。 - 错误处理:消息持久化和重试机制有助于处理暂时性的网络问题。 - 安全性:通过SSL/TLS可以确保消息传输的安全性。 6. 结论 RabbitMQ的强大之处在于它能跨越多种协议,提供了一种通用的消息传递平台。你知道吗,咱们可以像变魔术那样,把HTTP和gRPC这两个家伙灵活搭配起来,这样就能构建出一个超级灵动、随时能扩展的分布式系统,就跟你搭积木一样,想怎么拼就怎么拼,特别给力!当然啦,实际情况是会根据咱们项目的需求和手头现有的技术工具箱灵活调整具体实现方式,不过无论咋整,RabbitMQ都像是个超级靠谱的邮差,让各个服务之间的交流变得贼顺畅。
2024-02-23 11:44:00
92
笑傲江湖-t
转载文章
...used when connecting to the server 连接到服务器时使用的默认身份验证插件 default_authentication_plugin=caching_sha2_password The default storage engine that will be used when create new tables when 当创建新表时将使用的默认存储引擎 default-storage-engine=INNODB Set the SQL mode to strict 将SQL模式设置为strict sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION" General and Slow logging. 一般和缓慢的日志。 log-output=NONE general-log=0 general_log_file="DESKTOP-NF9QETB.log" slow-query-log=0 slow_query_log_file="DESKTOP-NF9QETB-slow.log" long_query_time=10 Binary Logging. 二进制日志。 log-bin Error Logging. 错误日志记录。 log-error="DESKTOP-NF9QETB.err" Server Id. server-id=1 Indicates how table and database names are stored on disk and used in MySQL. 指示表名和数据库名如何存储在磁盘上并在MySQL中使用。 Value = 0: Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement. Name comparisons are case sensitive. You should not set this variable to 0 if you are running MySQL on a system that has case-insensitive file names (such as Windows or macOS). Value = 0:表名和数据库名使用CREATE Table或CREATE database语句中指定的lettercase存储在磁盘上。名称比较区分大小写。如果您在一个具有不区分大小写文件名(如Windows或macOS)的系统上运行MySQL,则不应将该变量设置为0。 Value = 1: Table names are stored in lowercase on disk and name comparisons are not case-sensitive. MySQL converts all table names to lowercase on storage and lookup. This behavior also applies to database names and table aliases. 表名以小写存储在磁盘上,并且名称比较不区分大小写。MySQL在存储和查找时将所有表名转换为小写。此行为也适用于数据库名称和表别名。 Value = 3, Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement, but MySQL converts them to lowercase on lookup. Name comparisons are not case sensitive. This works only on file systems that are not case-sensitive! InnoDB table names and view names are stored in lowercase, as for Value = 1.表名和数据库名使用CREATE Table或CREATE database语句中指定的lettercase存储在磁盘上,但是MySQL在查找时将它们转换为小写。名称比较不区分大小写。这只适用于不区分大小写的文件系统!InnoDB表名和视图名以小写存储,Value = 1。 NOTE: lower_case_table_names can only be configured when initializing the server. Changing the lower_case_table_names setting after the server is initialized is prohibited. lower_case_table_names=1 Secure File Priv. 权限安全文件 secure-file-priv="C:/ProgramData/MySQL/MySQL Server 8.0/Uploads" The maximum amount of concurrent sessions the MySQL server will allow. One of these connections will be reserved for a user with SUPER privileges to allow the administrator to login even if the connection limit has been reached. MySQL服务器允许的最大并发会话量。这些连接中的一个将保留给具有超级特权的用户,以便允许管理员登录,即使已经达到连接限制。 max_connections=151 The number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires. Therefore you have to make sure to set the amount of open files allowed to at least 4096 in the variable "open-files-limit" in 为所有线程打开的表的数量。增加这个值会增加mysqld需要的文件描述符的数量。因此,您必须确保在[mysqld_safe]节中的变量“open-files-limit”中将允许打开的文件数量至少设置为4096 section [mysqld_safe] table_open_cache=2000 Maximum size for internal (in-memory) temporary tables. If a table grows larger than this value, it is automatically converted to disk based table This limitation is for a single table. There can be many of them. 内部(内存)临时表的最大大小。如果一个表比这个值大,那么它将自动转换为基于磁盘的表。可以有很多。 tmp_table_size=94M How many threads we should keep in a cache for reuse. When a client disconnects, the client's threads are put in the cache if there aren't more than thread_cache_size threads from before. This greatly reduces the amount of thread creations needed if you have a lot of new connections. (Normally this doesn't give a notable performance improvement if you have a good thread implementation.) 我们应该在缓存中保留多少线程以供重用。当客户机断开连接时,如果之前的线程数不超过thread_cache_size,则将客户机的线程放入缓存。如果您有很多新连接,这将大大减少所需的线程创建量(通常,如果您有一个良好的线程实现,这不会带来显著的性能改进)。 thread_cache_size=10 MyISAM Specific options The maximum size of the temporary file MySQL is allowed to use while recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE. If the file-size would be bigger than this, the index will be created through the key cache (which is slower). MySQL允许在重新创建索引时(在修复、修改表或加载数据时)使用临时文件的最大大小。如果文件大小大于这个值,那么索引将通过键缓存创建(这比较慢)。 myisam_max_sort_file_size=100G If the temporary file used for fast index creation would be bigger than using the key cache by the amount specified here, then prefer the key cache method. This is mainly used to force long character keys in large tables to use the slower key cache method to create the index. myisam_sort_buffer_size=179M Size of the Key Buffer, used to cache index blocks for MyISAM tables. Do not set it larger than 30% of your available memory, as some memory is also required by the OS to cache rows. Even if you're not using MyISAM tables, you should still set it to 8-64M as it will also be used for internal temporary disk tables. 如果用于快速创建索引的临时文件比这里指定的使用键缓存的文件大,则首选键缓存方法。这主要用于强制大型表中的长字符键使用较慢的键缓存方法来创建索引。 key_buffer_size=8M Size of the buffer used for doing full table scans of MyISAM tables. Allocated per thread, if a full scan is needed. 用于对MyISAM表执行全表扫描的缓冲区的大小。如果需要完整的扫描,则为每个线程分配。 read_buffer_size=256K read_rnd_buffer_size=512K INNODB Specific options INNODB特定选项 innodb_data_home_dir= Use this option if you have a MySQL server with InnoDB support enabled but you do not plan to use it. This will save memory and disk space and speed up some things. 如果您启用了一个支持InnoDB的MySQL服务器,但是您不打算使用它,那么可以使用这个选项。这将节省内存和磁盘空间,并加快一些事情。skip-innodb skip-innodb If set to 1, InnoDB will flush (fsync) the transaction logs to the disk at each commit, which offers full ACID behavior. If you are willing to compromise this safety, and you are running small transactions, you may set this to 0 or 2 to reduce disk I/O to the logs. Value 0 means that the log is only written to the log file and the log file flushed to disk approximately once per second. Value 2 means the log is written to the log file at each commit, but the log file is only flushed to disk approximately once per second. 如果设置为1,InnoDB将在每次提交时将事务日志刷新(fsync)到磁盘,这将提供完整的ACID行为。如果您愿意牺牲这种安全性,并且正在运行小型事务,您可以将其设置为0或2,以将磁盘I/O减少到日志。值0表示日志仅写入日志文件,日志文件大约每秒刷新一次磁盘。值2表示日志在每次提交时写入日志文件,但是日志文件大约每秒只刷新一次磁盘。 innodb_flush_log_at_trx_commit=1 The size of the buffer InnoDB uses for buffering log data. As soon as it is full, InnoDB will have to flush it to disk. As it is flushed once per second anyway, it does not make sense to have it very large (even with long transactions).InnoDB用于缓冲日志数据的缓冲区大小。一旦它满了,InnoDB就必须将它刷新到磁盘。由于它无论如何每秒刷新一次,所以将它设置为非常大的值是没有意义的(即使是长事务)。 innodb_log_buffer_size=5M InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and row data. The bigger you set this the less disk I/O is needed to access data in tables. On a dedicated database server you may set this parameter up to 80% of the machine physical memory size. Do not set it too large, though, because competition of the physical memory may cause paging in the operating system. Note that on 32bit systems you might be limited to 2-3.5G of user level memory per process, so do not set it too high. 与MyISAM不同,InnoDB使用缓冲池来缓存索引和行数据。设置的值越大,访问表中的数据所需的磁盘I/O就越少。在专用数据库服务器上,可以将该参数设置为机器物理内存大小的80%。但是,不要将它设置得太大,因为物理内存的竞争可能会导致操作系统中的分页。注意,在32位系统上,每个进程的用户级内存可能被限制在2-3.5G,所以不要设置得太高。 innodb_buffer_pool_size=20M Size of each log file in a log group. You should set the combined size of log files to about 25%-100% of your buffer pool size to avoid unneeded buffer pool flush activity on log file overwrite. However, note that a larger logfile size will increase the time needed for the recovery process. 日志组中每个日志文件的大小。您应该将日志文件的合并大小设置为缓冲池大小的25%-100%,以避免在覆盖日志文件时出现不必要的缓冲池刷新活动。但是,请注意,较大的日志文件大小将增加恢复过程所需的时间。 innodb_log_file_size=48M Number of threads allowed inside the InnoDB kernel. The optimal value depends highly on the application, hardware as well as the OS scheduler properties. A too high value may lead to thread thrashing. InnoDB内核中允许的线程数。最优值在很大程度上取决于应用程序、硬件以及OS调度程序属性。过高的值可能导致线程抖动。 innodb_thread_concurrency=9 The increment size (in MB) for extending the size of an auto-extend InnoDB system tablespace file when it becomes full. 增量大小(以MB为单位),用于在表空间满时扩展自动扩展的InnoDB系统表空间文件的大小。 innodb_autoextend_increment=128 The number of regions that the InnoDB buffer pool is divided into. For systems with buffer pools in the multi-gigabyte range, dividing the buffer pool into separate instances can improve concurrency, by reducing contention as different threads read and write to cached pages. InnoDB缓冲池划分的区域数。对于具有多gb缓冲池的系统,将缓冲池划分为单独的实例可以提高并发性,因为不同的线程对缓存页面的读写会减少争用。 innodb_buffer_pool_instances=8 Determines the number of threads that can enter InnoDB concurrently. 确定可以同时进入InnoDB的线程数 innodb_concurrency_tickets=5000 Specifies how long in milliseconds (ms) a block inserted into the old sublist must stay there after its first access before it can be moved to the new sublist. 指定插入到旧子列表中的块必须在第一次访问之后停留多长时间(毫秒),然后才能移动到新子列表。 innodb_old_blocks_time=1000 It specifies the maximum number of .ibd files that MySQL can keep open at one time. The minimum value is 10. 它指定MySQL一次可以打开的.ibd文件的最大数量。最小值是10。 innodb_open_files=300 When this variable is enabled, InnoDB updates statistics during metadata statements. 当启用此变量时,InnoDB会在元数据语句期间更新统计信息。 innodb_stats_on_metadata=0 When innodb_file_per_table is enabled (the default in 5.6.6 and higher), InnoDB stores the data and indexes for each newly created table in a separate .ibd file, rather than in the system tablespace. 当启用innodb_file_per_table(5.6.6或更高版本的默认值)时,InnoDB将每个新创建的表的数据和索引存储在单独的.ibd文件中,而不是系统表空间中。 innodb_file_per_table=1 Use the following list of values: 0 for crc32, 1 for strict_crc32, 2 for innodb, 3 for strict_innodb, 4 for none, 5 for strict_none. 使用以下值列表:0表示crc32, 1表示strict_crc32, 2表示innodb, 3表示strict_innodb, 4表示none, 5表示strict_none。 innodb_checksum_algorithm=0 The number of outstanding connection requests MySQL can have. This option is useful when the main MySQL thread gets many connection requests in a very short time. It then takes some time (although very little) for the main thread to check the connection and start a new thread. The back_log value indicates how many requests can be stacked during this short time before MySQL momentarily stops answering new requests. You need to increase this only if you expect a large number of connections in a short period of time. MySQL可以有多少未完成连接请求。当MySQL主线程在很短的时间内收到许多连接请求时,这个选项非常有用。然后,主线程需要一些时间(尽管很少)来检查连接并启动一个新线程。back_log值表示在MySQL暂时停止响应新请求之前的短时间内可以堆多少个请求。只有当您预期在短时间内会有大量连接时,才需要增加这个值。 back_log=80 If this is set to a nonzero value, all tables are closed every flush_time seconds to free up resources and synchronize unflushed data to disk. This option is best used only on systems with minimal resources. 如果将该值设置为非零值,则每隔flush_time秒关闭所有表,以释放资源并将未刷新的数据同步到磁盘。这个选项最好只在资源最少的系统上使用。 flush_time=0 The minimum size of the buffer that is used for plain index scans, range index scans, and joins that do not use 用于普通索引扫描、范围索引扫描和不使用索引执行全表扫描的连接的缓冲区的最小大小。 indexes and thus perform full table scans. join_buffer_size=200M The maximum size of one packet or any generated or intermediate string, or any parameter sent by the mysql_stmt_send_long_data() C API function. 由mysql_stmt_send_long_data() C API函数发送的一个包或任何生成的或中间字符串或任何参数的最大大小 max_allowed_packet=500M If more than this many successive connection requests from a host are interrupted without a successful connection, the server blocks that host from performing further connections. 如果在没有成功连接的情况下中断了来自主机的多个连续连接请求,则服务器将阻止主机执行进一步的连接。 max_connect_errors=100 Changes the number of file descriptors available to mysqld. You should try increasing the value of this option if mysqld gives you the error "Too many open files". 更改mysqld可用的文件描述符的数量。如果mysqld给您的错误是“打开的文件太多”,您应该尝试增加这个选项的值。 open_files_limit=4161 If you see many sort_merge_passes per second in SHOW GLOBAL STATUS output, you can consider increasing the sort_buffer_size value to speed up ORDER BY or GROUP BY operations that cannot be improved with query optimization or improved indexing. 如果在SHOW GLOBAL STATUS输出中每秒看到许多sort_merge_passes,可以考虑增加sort_buffer_size值,以加快ORDER BY或GROUP BY操作的速度,这些操作无法通过查询优化或改进索引来改进。 sort_buffer_size=1M The number of table definitions (from .frm files) that can be stored in the definition cache. If you use a large number of tables, you can create a large table definition cache to speed up opening of tables. The table definition cache takes less space and does not use file descriptors, unlike the normal table cache. The minimum and default values are both 400. 可以存储在定义缓存中的表定义的数量(来自.frm文件)。如果使用大量表,可以创建一个大型表定义缓存来加速表的打开。与普通的表缓存不同,表定义缓存占用更少的空间,并且不使用文件描述符。最小值和默认值都是400。 table_definition_cache=1400 Specify the maximum size of a row-based binary log event, in bytes. Rows are grouped into events smaller than this size if possible. The value should be a multiple of 256. 指定基于行的二进制日志事件的最大大小,单位为字节。如果可能,将行分组为小于此大小的事件。这个值应该是256的倍数。 binlog_row_event_max_size=8K If the value of this variable is greater than 0, a replication slave synchronizes its master.info file to disk. (using fdatasync()) after every sync_master_info events. 如果该变量的值大于0,则复制奴隶将其主.info文件同步到磁盘。(在每个sync_master_info事件之后使用fdatasync())。 sync_master_info=10000 If the value of this variable is greater than 0, the MySQL server synchronizes its relay log to disk. (using fdatasync()) after every sync_relay_log writes to the relay log. 如果这个变量的值大于0,MySQL服务器将其中继日志同步到磁盘。(在每个sync_relay_log写入到中继日志之后使用fdatasync())。 sync_relay_log=10000 If the value of this variable is greater than 0, a replication slave synchronizes its relay-log.info file to disk. (using fdatasync()) after every sync_relay_log_info transactions. 如果该变量的值大于0,则复制奴隶将其中继日志.info文件同步到磁盘。(在每个sync_relay_log_info事务之后使用fdatasync())。 sync_relay_log_info=10000 Load mysql plugins at start."plugin_x ; plugin_y". 开始时加载mysql插件。“plugin_x;plugin_y” plugin_load The TCP/IP Port the MySQL Server X Protocol will listen on. MySQL服务器X协议将监听TCP/IP端口。 loose_mysqlx_port=33060 本篇文章为转载内容。原文链接:https://blog.csdn.net/mywpython/article/details/89499852。 该文由互联网用户投稿提供,文中观点代表作者本人意见,并不代表本站的立场。 作为信息平台,本站仅提供文章转载服务,并不拥有其所有权,也不对文章内容的真实性、准确性和合法性承担责任。 如发现本文存在侵权、违法、违规或事实不符的情况,请及时联系我们,我们将第一时间进行核实并删除相应内容。
2023-10-08 09:56:02
129
转载
MySQL
...ort mysql.connector mydb = mysql.connector.connect( host="localhost", user="yourusername", password="yourpassword", database="yourdatabase" ) mycursor = mydb.cursor() mycursor.execute("SELECT FROM customers") myresult = mycursor.fetchall() for x in myresult: print(x) //采用Java访问MySQL import java.sql.; public class ReadMySQL { public static void main(String[] args) { try { Connection myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/yourdatabase", "yourusername", "yourpassword"); Statement myStmt = myConn.createStatement(); ResultSet myRs = myStmt.executeQuery("SELECT FROM customers"); while (myRs.next()) { System.out.println(myRs.getString("name") + "," + myRs.getString("email")); } } catch (Exception exc) { exc.printStackTrace(); } } } 以上是采用Python和Java访问MySQL的示例,访问MySQL还可以采用其他编程语言,如PHP、Ruby等。同时,为了提高MySQL的访问效率,也可以引入缓存技术,如Memcached、Redis等。
2024-02-28 15:31:14
130
逻辑鬼才
ActiveMQ
...iveMQ连接工厂 ConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616"); // 从连接工厂创建连接 Connection connection = factory.createConnection(); connection.start(); // 创建会话 Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // 创建目标队列 Destination destination = session.createQueue("MyQueue"); // 创建生产者 MessageProducer producer = session.createProducer(destination); // 创建并发送消息 TextMessage message = session.createTextMessage("Hello from ActiveMQ!"); producer.send(message); 上述代码展示了如何使用Java API创建一个简单的ActiveMQ生产者,向名为"MyQueue"的队列发送一条消息。 3. Camel与ActiveMQ的集成 Apache Camel通过提供丰富的组件库来简化集成任务,其中当然也包含了对ActiveMQ的出色支持。使用Camel-ActiveMQ这个小玩意儿,我们就能轻轻松松地在Camel的路由规则里头,用ActiveMQ来发送和接收消息,就像玩儿一样简单! java from("timer:tick?period=5000") // 每5秒触发一次 .setBody(constant("Hello Camel with ActiveMQ!")) .to("activemq:queue:MyQueue"); // 将消息发送到ActiveMQ队列 from("activemq:queue:MyQueue") // 从ActiveMQ队列消费消息 .log("Received message: ${body}") .to("mock:result"); // 将消息转发至Mock endpoint用于测试 这段Camel路由配置清晰地展现了如何通过Camel定时器触发消息产生,并将其发送至ActiveMQ队列,同时又设置了一个消费者从该队列中拉取消息并打印处理。 4. Camel集成ActiveMQ的优势及应用场景 通过Camel与ActiveMQ的集成,开发者可以利用Camel的强大路由能力,实现复杂的消息流转逻辑,如内容过滤、转换、分发等。此外,Camel还提供了健壮的错误处理机制,使得整个消息流更具鲁棒性。 例如,在微服务架构下,多个服务间的数据同步、事件通知等问题可以通过ActiveMQ与Camel的结合得到优雅解决。当某个服务干完活儿,处理完了业务,它只需要轻轻松松地把结果信息发布到特定的那个“消息主题”或者“队列”里头。这样一来,其他那些有关联的服务就能像订报纸一样,实时获取到这些新鲜出炉的信息。这就像是大家各忙各的,但又能及时知道彼此的工作进展,既解耦了服务之间的紧密依赖,又实现了异步通信,让整个系统运行得更加灵活、高效。 5. 结语 总的来说,Apache Camel与ActiveMQ的集成极大地扩展了消息驱动系统的可能性,赋予开发者以更高层次的抽象去设计和实现复杂的集成场景。这种联手合作的方式,就像两个超级英雄组队,让整个系统变得身手更加矫健、灵活多变,而且还能够随需应变地扩展升级。这样一来,咱们每天的开发工作简直像是坐上了火箭,效率嗖嗖往上升,维护成本也像滑梯一样唰唰降低,真是省时省力又省心呐!当我们面对大规模、多组件的分布式系统时,不妨尝试借助于Camel和ActiveMQ的力量,让消息传递变得更简单、更强大。
2023-05-29 14:05:13
552
灵动之光
Mongo
...ngoClient.connect('mongodb://localhost:27017/mydatabase', { useNewUrlParser: true, useUnifiedTopology: true }, (err, client) => { if (err) { console.error('Error connecting to MongoDB:', err); return; } console.log('Connected successfully to MongoDB'); // 使用client对象进行数据库操作... const db = client.db(); // ... // 在完成所有数据库操作后,记得关闭连接 client.close(); }); 上述代码展示了如何异步地连接到MongoDB数据库。这里,MongoClient.connect()方法接受一个连接字符串、配置选项以及一个回调函数。当连接成功建立或发生错误时,回调函数会被调用。这正是异步编程的体现,主线程不会被阻塞,直到连接操作完成才执行后续逻辑。 3. 向MongoDB数据库异步写入数据 同样,向MongoDB插入或更新数据也是异步执行的。下面是一个向集合中插入文档的例子: javascript db.collection('mycollection').insertOne({ name: 'John Doe', age: 30 }, (err, result) => { if (err) { console.error('Error inserting document:', err); return; } console.log('Document inserted successfully:', result.insertedId); // 插入操作完成后,可以在这里执行其他逻辑 }); // 注意:这里的db是上一步异步连接成功后获取的数据库实例 这段代码展示了如何异步地向MongoDB的一个集合插入一个文档。你知道吗,这个insertOne()方法就像是个贴心的小帮手,它会接收一个文档对象作为“礼物”,然后再加上一个神奇的回调函数。当你把这个“礼物”放进去,或者在插入过程中不小心出了点小差错的时候,这个神奇的回调函数就会立马跳出来开始干活儿啦! 4. 思考与探讨 在实际开发过程中,异步操作无疑提升了我们的应用性能和用户体验。然而,这也带来了回调地狱、复杂的流程控制等问题。还好啦,现代的JavaScript可真是够意思的,它引入了Promise、async/await这些超级实用的工具,让咱们在处理异步编程时简直如虎添翼。这样一来,我们在和MongoDB打交道的时候,就能写出更加顺溜、更好懂、更好维护的代码,那感觉别提多棒了! 总结来说,MongoDB在连接数据库和写入数据时采取异步机制,这种设计让我们能够在高并发环境下更好地优化资源利用,提升系统效率。同时,作为开发者大兄弟,咱们得深入理解并灵活玩转异步编程这门艺术,才能应对各种意想不到的挑战,把MongoDB那牛哄哄的功能发挥到极致。
2024-03-10 10:44:19
167
林中小径_
转载文章
...et服务器实例上的 connection 事件转换为可观察对象,然后订阅这个可观察对象以便在客户端连接到WebSocket服务器时触发相应的事件处理函数(即onConnect函数),从而在控制台上打印出连接成功的日志消息。
2023-03-19 12:00:21
52
转载
转载文章
...添加新的 数据类型 函数 操作 聚合函数 索引类型 过程语言 安装 环境说明 由于资源有限,gtm一台、另外两台身兼数职。 主机名 IP 角色 端口 nodename 数据目录 gtm 192.168.20.132 GTM 6666 gtm /nodes/gtm 协调器 5432 coord1 /nodes/coordinator xl1 192.168.20.133 数据节点 5433 node1 /nodes/pgdata gtm代理 6666 gtmpoxy01 /nodes/gtm_pxy1 协调器 5432 coord2 /nodes/coordinator xl2 192.168.20.134 数据节点 5433 node2 /nodes/pgdata gtm代理 6666 gtmpoxy02 /nodes/gtm_pxy2 要求 GNU make版本 3.8及以上版本 [root@pg ~] make --versionGNU Make 3.82Built for x86_64-redhat-linux-gnuCopyright (C) 2010 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law. 需安装GCC包 需安装tar包 用于解压缩文件 默认需要GNU Readline library 其作用是可以让psql命令行记住执行过的命令,并且可以通过键盘上下键切换命令。但是可以通过--without-readline禁用这个特性,或者可以指定--withlibedit-preferred选项来使用libedit 默认使用zlib压缩库 可通过--without-zlib选项来禁用 配置hosts 所有主机上都配置 [root@xl2 11] cat /etc/hosts127.0.0.1 localhost192.168.20.132 gtm192.168.20.133 xl1192.168.20.134 xl2 关闭防火墙、Selinux 所有主机都执行 关闭防火墙: [root@gtm ~] systemctl stop firewalld.service[root@gtm ~] systemctl disable firewalld.service selinux设置: [root@gtm ~]vim /etc/selinux/config 设置SELINUX=disabled,保存退出。 This file controls the state of SELinux on the system. SELINUX= can take one of these three values: enforcing - SELinux security policy is enforced. permissive - SELinux prints warnings instead of enforcing. disabled - No SELinux policy is loaded.SELINUX=disabled SELINUXTYPE= can take one of three two values: targeted - Targeted processes are protected, minimum - Modification of targeted policy. Only selected processes are protected. mls - Multi Level Security protection. 安装依赖包 所有主机上都执行 yum install -y flex bison readline-devel zlib-devel openjade docbook-style-dsssl gcc 创建用户 所有主机上都执行 [root@gtm ~] useradd postgres[root@gtm ~] passwd postgres[root@gtm ~] su - postgres[root@gtm ~] mkdir ~/.ssh[root@gtm ~] chmod 700 ~/.ssh 配置SSH免密登录 仅仅在gtm节点配置如下操作: [root@gtm ~] su - postgres[postgres@gtm ~] ssh-keygen -t rsa[postgres@gtm ~] cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys[postgres@gtm ~] chmod 600 ~/.ssh/authorized_keys 将刚生成的认证文件拷贝到xl1到xl2中,使得gtm节点可以免密码登录xl1~xl2的任意一个节点: [postgres@gtm ~] scp ~/.ssh/authorized_keys postgres@xl1:~/.ssh/[postgres@gtm ~] scp ~/.ssh/authorized_keys postgres@xl2:~/.ssh/ 对所有提示都不要输入,直接enter下一步。直到最后,因为第一次要求输入目标机器的用户密码,输入即可。 下载源码 下载地址:https://www.postgres-xl.org/download/ [root@slave ~] ll postgres-xl-10r1.1.tar.gz-rw-r--r-- 1 root root 28121666 May 30 05:21 postgres-xl-10r1.1.tar.gz 编译、安装Postgres-XL 所有节点都安装,编译需要一点时间,最好同时进行编译。 [root@slave ~] tar xvf postgres-xl-10r1.1.tar.gz[root@slave ~] ./configure --prefix=/home/postgres/pgxl/[root@slave ~] make[root@slave ~] make install[root@slave ~] cd contrib/ --安装必要的工具,在gtm节点上安装即可[root@slave ~] make[root@slave ~] make install 配置环境变量 所有节点都要配置 进入postgres用户,修改其环境变量,开始编辑 [root@gtm ~]su - postgres[postgres@gtm ~]vi .bashrc --不是.bash_profile 在打开的文件末尾,新增如下变量配置: export PGHOME=/home/postgres/pgxlexport LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATHexport PATH=$PGHOME/bin:$PATH 按住esc,然后输入:wq!保存退出。输入以下命令对更改重启生效。 [postgres@gtm ~] source .bashrc --不是.bash_profile 输入以下语句,如果输出变量结果,代表生效 [postgres@gtm ~] echo $PGHOME 应该输出/home/postgres/pgxl代表生效 配置集群 生成pgxc_ctl.conf配置文件 [postgres@gtm ~] pgxc_ctl prepare/bin/bashInstalling pgxc_ctl_bash script as /home/postgres/pgxl/pgxc_ctl/pgxc_ctl_bash.ERROR: File "/home/postgres/pgxl/pgxc_ctl/pgxc_ctl.conf" not found or not a regular file. No such file or directoryInstalling pgxc_ctl_bash script as /home/postgres/pgxl/pgxc_ctl/pgxc_ctl_bash.Reading configuration using /home/postgres/pgxl/pgxc_ctl/pgxc_ctl_bash --home /home/postgres/pgxl/pgxc_ctl --configuration /home/postgres/pgxl/pgxc_ctl/pgxc_ctl.confFinished reading configuration. PGXC_CTL START Current directory: /home/postgres/pgxl/pgxc_ctl 配置pgxc_ctl.conf 新建/home/postgres/pgxc_ctl/pgxc_ctl.conf文件,编辑如下: 对着模板文件一个一个修改,否则会造成初始化过程出现各种神奇问题。 pgxcInstallDir=$PGHOMEpgxlDATA=$PGHOME/data pgxcOwner=postgres---- GTM Master -----------------------------------------gtmName=gtmgtmMasterServer=gtmgtmMasterPort=6666gtmMasterDir=$pgxlDATA/nodes/gtmgtmSlave=y Specify y if you configure GTM Slave. Otherwise, GTM slave will not be configured and all the following variables will be reset.gtmSlaveName=gtmSlavegtmSlaveServer=gtm value none means GTM slave is not available. Give none if you don't configure GTM Slave.gtmSlavePort=20001 Not used if you don't configure GTM slave.gtmSlaveDir=$pgxlDATA/nodes/gtmSlave Not used if you don't configure GTM slave.---- GTM-Proxy Master -------gtmProxyDir=$pgxlDATA/nodes/gtm_proxygtmProxy=y gtmProxyNames=(gtm_pxy1 gtm_pxy2) gtmProxyServers=(xl1 xl2) gtmProxyPorts=(6666 6666) gtmProxyDirs=($gtmProxyDir $gtmProxyDir) ---- Coordinators ---------coordMasterDir=$pgxlDATA/nodes/coordcoordNames=(coord1 coord2) coordPorts=(5432 5432) poolerPorts=(6667 6667) coordPgHbaEntries=(0.0.0.0/0)coordMasterServers=(xl1 xl2) coordMasterDirs=($coordMasterDir $coordMasterDir)coordMaxWALsernder=0 没设置备份节点,设置为0coordMaxWALSenders=($coordMaxWALsernder $coordMaxWALsernder) 数量保持和coordMasterServers一致coordSlave=n---- Datanodes ----------datanodeMasterDir=$pgxlDATA/nodes/dn_masterprimaryDatanode=xl1 主数据节点datanodeNames=(node1 node2)datanodePorts=(5433 5433) datanodePoolerPorts=(6668 6668) datanodePgHbaEntries=(0.0.0.0/0)datanodeMasterServers=(xl1 xl2)datanodeMasterDirs=($datanodeMasterDir $datanodeMasterDir)datanodeMaxWalSender=4datanodeMaxWALSenders=($datanodeMaxWalSender $datanodeMaxWalSender) 集群初始化,启动,停止 初始化 pgxc_ctl -c /home/postgres/pgxc_ctl/pgxc_ctl.conf init all 输出结果: /bin/bashInstalling pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Installing pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Reading configuration using /home/postgres/pgxc_ctl/pgxc_ctl_bash --home /home/postgres/pgxc_ctl --configuration /home/postgres/pgxc_ctl/pgxc_ctl.conf/home/postgres/pgxc_ctl/pgxc_ctl.conf: line 189: $coordExtraConfig: ambiguous redirectFinished reading configuration. PGXC_CTL START Current directory: /home/postgres/pgxc_ctlStopping all the coordinator masters.Stopping coordinator master coord1.Stopping coordinator master coord2.pg_ctl: directory "/home/postgres/pgxc/nodes/coord/coord1" does not existpg_ctl: directory "/home/postgres/pgxc/nodes/coord/coord2" does not existDone.Stopping all the datanode masters.Stopping datanode master datanode1.Stopping datanode master datanode2.pg_ctl: PID file "/home/postgres/pgxc/nodes/datanode/datanode1/postmaster.pid" does not existIs server running?Done.Stop GTM masterwaiting for server to shut down.... doneserver stopped[postgres@gtm ~]$ echo $PGHOME/home/postgres/pgxl[postgres@gtm ~]$ ll /home/postgres/pgxl/pgxc/nodes/gtm/gtm.^C[postgres@gtm ~]$ pgxc_ctl -c /home/postgres/pgxc_ctl/pgxc_ctl.conf init all/bin/bashInstalling pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Installing pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Reading configuration using /home/postgres/pgxc_ctl/pgxc_ctl_bash --home /home/postgres/pgxc_ctl --configuration /home/postgres/pgxc_ctl/pgxc_ctl.conf/home/postgres/pgxc_ctl/pgxc_ctl.conf: line 189: $coordExtraConfig: ambiguous redirectFinished reading configuration. PGXC_CTL START Current directory: /home/postgres/pgxc_ctlInitialize GTM masterERROR: target directory (/home/postgres/pgxc/nodes/gtm) exists and not empty. Skip GTM initilializationDone.Start GTM masterserver startingInitialize all the coordinator masters.Initialize coordinator master coord1.ERROR: target coordinator master coord1 is running now. Skip initilialization.Initialize coordinator master coord2.The files belonging to this database system will be owned by user "postgres".This user must also own the server process.The database cluster will be initialized with locale "en_US.UTF-8".The default database encoding has accordingly been set to "UTF8".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /home/postgres/pgxc/nodes/coord/coord2 ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting dynamic shared memory implementation ... posixcreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... creating cluster information ... oksyncing data to disk ... okfreezing database template0 ... okfreezing database template1 ... okfreezing database postgres ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success.Done.Starting coordinator master.Starting coordinator master coord1ERROR: target coordinator master coord1 is already running now. Skip initialization.Starting coordinator master coord22019-05-30 21:09:25.562 EDT [2148] LOG: listening on IPv4 address "0.0.0.0", port 54322019-05-30 21:09:25.562 EDT [2148] LOG: listening on IPv6 address "::", port 54322019-05-30 21:09:25.563 EDT [2148] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"2019-05-30 21:09:25.601 EDT [2149] LOG: database system was shut down at 2019-05-30 21:09:22 EDT2019-05-30 21:09:25.605 EDT [2148] LOG: database system is ready to accept connections2019-05-30 21:09:25.612 EDT [2156] LOG: cluster monitor startedDone.Initialize all the datanode masters.Initialize the datanode master datanode1.Initialize the datanode master datanode2.The files belonging to this database system will be owned by user "postgres".This user must also own the server process.The database cluster will be initialized with locale "en_US.UTF-8".The default database encoding has accordingly been set to "UTF8".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /home/postgres/pgxc/nodes/datanode/datanode1 ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting dynamic shared memory implementation ... posixcreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... creating cluster information ... oksyncing data to disk ... okfreezing database template0 ... okfreezing database template1 ... okfreezing database postgres ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success.The files belonging to this database system will be owned by user "postgres".This user must also own the server process.The database cluster will be initialized with locale "en_US.UTF-8".The default database encoding has accordingly been set to "UTF8".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /home/postgres/pgxc/nodes/datanode/datanode2 ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting dynamic shared memory implementation ... posixcreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... creating cluster information ... oksyncing data to disk ... okfreezing database template0 ... okfreezing database template1 ... okfreezing database postgres ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success.Done.Starting all the datanode masters.Starting datanode master datanode1.WARNING: datanode master datanode1 is running now. Skipping.Starting datanode master datanode2.2019-05-30 21:09:33.352 EDT [2404] LOG: listening on IPv4 address "0.0.0.0", port 154322019-05-30 21:09:33.352 EDT [2404] LOG: listening on IPv6 address "::", port 154322019-05-30 21:09:33.355 EDT [2404] LOG: listening on Unix socket "/tmp/.s.PGSQL.15432"2019-05-30 21:09:33.392 EDT [2404] LOG: redirecting log output to logging collector process2019-05-30 21:09:33.392 EDT [2404] HINT: Future log output will appear in directory "pg_log".Done.psql: FATAL: no pg_hba.conf entry for host "192.168.20.132", user "postgres", database "postgres"psql: FATAL: no pg_hba.conf entry for host "192.168.20.132", user "postgres", database "postgres"Done.psql: FATAL: no pg_hba.conf entry for host "192.168.20.132", user "postgres", database "postgres"psql: FATAL: no pg_hba.conf entry for host "192.168.20.132", user "postgres", database "postgres"Done.[postgres@gtm ~]$ pgxc_ctl -c /home/postgres/pgxc_ctl/pgxc_ctl.conf stop all/bin/bashInstalling pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Installing pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Reading configuration using /home/postgres/pgxc_ctl/pgxc_ctl_bash --home /home/postgres/pgxc_ctl --configuration /home/postgres/pgxc_ctl/pgxc_ctl.conf/home/postgres/pgxc_ctl/pgxc_ctl.conf: line 189: $coordExtraConfig: ambiguous redirectFinished reading configuration. PGXC_CTL START Current directory: /home/postgres/pgxc_ctlStopping all the coordinator masters.Stopping coordinator master coord1.Stopping coordinator master coord2.pg_ctl: directory "/home/postgres/pgxc/nodes/coord/coord1" does not existDone.Stopping all the datanode masters.Stopping datanode master datanode1.Stopping datanode master datanode2.pg_ctl: PID file "/home/postgres/pgxc/nodes/datanode/datanode1/postmaster.pid" does not existIs server running?Done.Stop GTM masterwaiting for server to shut down.... doneserver stopped[postgres@gtm ~]$ pgxc_ctl/bin/bashInstalling pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Installing pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Reading configuration using /home/postgres/pgxc_ctl/pgxc_ctl_bash --home /home/postgres/pgxc_ctl --configuration /home/postgres/pgxc_ctl/pgxc_ctl.conf/home/postgres/pgxc_ctl/pgxc_ctl.conf: line 189: $coordExtraConfig: ambiguous redirectFinished reading configuration. PGXC_CTL START Current directory: /home/postgres/pgxc_ctlPGXC monitor allNot running: gtm masterRunning: coordinator master coord1Not running: coordinator master coord2Running: datanode master datanode1Not running: datanode master datanode2PGXC stop coordinator master coord1Stopping coordinator master coord1.pg_ctl: directory "/home/postgres/pgxc/nodes/coord/coord1" does not existDone.PGXC stop datanode master datanode1Stopping datanode master datanode1.pg_ctl: PID file "/home/postgres/pgxc/nodes/datanode/datanode1/postmaster.pid" does not existIs server running?Done.PGXC monitor allNot running: gtm masterRunning: coordinator master coord1Not running: coordinator master coord2Running: datanode master datanode1Not running: datanode master datanode2PGXC monitor allNot running: gtm masterNot running: coordinator master coord1Not running: coordinator master coord2Not running: datanode master datanode1Not running: datanode master datanode2PGXC exit[postgres@gtm ~]$ pgxc_ctl -c /home/postgres/pgxc_ctl/pgxc_ctl.conf init all/bin/bashInstalling pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Installing pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Reading configuration using /home/postgres/pgxc_ctl/pgxc_ctl_bash --home /home/postgres/pgxc_ctl --configuration /home/postgres/pgxc_ctl/pgxc_ctl.conf/home/postgres/pgxc_ctl/pgxc_ctl.conf: line 189: $coordExtraConfig: ambiguous redirectFinished reading configuration. PGXC_CTL START Current directory: /home/postgres/pgxc_ctlInitialize GTM masterERROR: target directory (/home/postgres/pgxc/nodes/gtm) exists and not empty. Skip GTM initilializationDone.Start GTM masterserver startingInitialize all the coordinator masters.Initialize coordinator master coord1.Initialize coordinator master coord2.The files belonging to this database system will be owned by user "postgres".This user must also own the server process.The database cluster will be initialized with locale "en_US.UTF-8".The default database encoding has accordingly been set to "UTF8".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /home/postgres/pgxc/nodes/coord/coord1 ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting dynamic shared memory implementation ... posixcreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... creating cluster information ... oksyncing data to disk ... okfreezing database template0 ... okfreezing database template1 ... okfreezing database postgres ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success.The files belonging to this database system will be owned by user "postgres".This user must also own the server process.The database cluster will be initialized with locale "en_US.UTF-8".The default database encoding has accordingly been set to "UTF8".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /home/postgres/pgxc/nodes/coord/coord2 ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting dynamic shared memory implementation ... posixcreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... creating cluster information ... oksyncing data to disk ... okfreezing database template0 ... okfreezing database template1 ... okfreezing database postgres ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success.Done.Starting coordinator master.Starting coordinator master coord1Starting coordinator master coord22019-05-30 21:13:03.998 EDT [25137] LOG: listening on IPv4 address "0.0.0.0", port 54322019-05-30 21:13:03.998 EDT [25137] LOG: listening on IPv6 address "::", port 54322019-05-30 21:13:04.000 EDT [25137] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"2019-05-30 21:13:04.038 EDT [25138] LOG: database system was shut down at 2019-05-30 21:13:00 EDT2019-05-30 21:13:04.042 EDT [25137] LOG: database system is ready to accept connections2019-05-30 21:13:04.049 EDT [25145] LOG: cluster monitor started2019-05-30 21:13:04.020 EDT [2730] LOG: listening on IPv4 address "0.0.0.0", port 54322019-05-30 21:13:04.020 EDT [2730] LOG: listening on IPv6 address "::", port 54322019-05-30 21:13:04.021 EDT [2730] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"2019-05-30 21:13:04.057 EDT [2731] LOG: database system was shut down at 2019-05-30 21:13:00 EDT2019-05-30 21:13:04.061 EDT [2730] LOG: database system is ready to accept connections2019-05-30 21:13:04.062 EDT [2738] LOG: cluster monitor startedDone.Initialize all the datanode masters.Initialize the datanode master datanode1.Initialize the datanode master datanode2.The files belonging to this database system will be owned by user "postgres".This user must also own the server process.The database cluster will be initialized with locale "en_US.UTF-8".The default database encoding has accordingly been set to "UTF8".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /home/postgres/pgxc/nodes/datanode/datanode1 ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting dynamic shared memory implementation ... posixcreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... creating cluster information ... oksyncing data to disk ... okfreezing database template0 ... okfreezing database template1 ... okfreezing database postgres ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success.The files belonging to this database system will be owned by user "postgres".This user must also own the server process.The database cluster will be initialized with locale "en_US.UTF-8".The default database encoding has accordingly been set to "UTF8".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /home/postgres/pgxc/nodes/datanode/datanode2 ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting dynamic shared memory implementation ... posixcreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... creating cluster information ... oksyncing data to disk ... okfreezing database template0 ... okfreezing database template1 ... okfreezing database postgres ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success.Done.Starting all the datanode masters.Starting datanode master datanode1.Starting datanode master datanode2.2019-05-30 21:13:12.077 EDT [25392] LOG: listening on IPv4 address "0.0.0.0", port 154322019-05-30 21:13:12.077 EDT [25392] LOG: listening on IPv6 address "::", port 154322019-05-30 21:13:12.079 EDT [25392] LOG: listening on Unix socket "/tmp/.s.PGSQL.15432"2019-05-30 21:13:12.114 EDT [25392] LOG: redirecting log output to logging collector process2019-05-30 21:13:12.114 EDT [25392] HINT: Future log output will appear in directory "pg_log".2019-05-30 21:13:12.079 EDT [2985] LOG: listening on IPv4 address "0.0.0.0", port 154322019-05-30 21:13:12.079 EDT [2985] LOG: listening on IPv6 address "::", port 154322019-05-30 21:13:12.081 EDT [2985] LOG: listening on Unix socket "/tmp/.s.PGSQL.15432"2019-05-30 21:13:12.117 EDT [2985] LOG: redirecting log output to logging collector process2019-05-30 21:13:12.117 EDT [2985] HINT: Future log output will appear in directory "pg_log".Done.psql: FATAL: no pg_hba.conf entry for host "192.168.20.132", user "postgres", database "postgres"psql: FATAL: no pg_hba.conf entry for host "192.168.20.132", user "postgres", database "postgres"Done.psql: FATAL: no pg_hba.conf entry for host "192.168.20.132", user "postgres", database "postgres"psql: FATAL: no pg_hba.conf entry for host "192.168.20.132", user "postgres", database "postgres"Done. 启动 pgxc_ctl -c /home/postgres/pgxc_ctl/pgxc_ctl.conf start all 关闭 pgxc_ctl -c /home/postgres/pgxc_ctl/pgxc_ctl.conf stop all 查看集群状态 [postgres@gtm ~]$ pgxc_ctl monitor all/bin/bashInstalling pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Installing pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Reading configuration using /home/postgres/pgxc_ctl/pgxc_ctl_bash --home /home/postgres/pgxc_ctl --configuration /home/postgres/pgxc_ctl/pgxc_ctl.conf/home/postgres/pgxc_ctl/pgxc_ctl.conf: line 189: $coordExtraConfig: ambiguous redirectFinished reading configuration. PGXC_CTL START Current directory: /home/postgres/pgxc_ctlRunning: gtm masterRunning: coordinator master coord1Running: coordinator master coord2Running: datanode master datanode1Running: datanode master datanode2 配置集群信息 分别在数据节点、协调器节点上分别执行以下命令: 注:本节点只执行修改操作即可(alert node),其他节点执行创建命令(create node)。因为本节点已经包含本节点的信息。 create node coord1 with (type=coordinator,host=xl1, port=5432);create node coord2 with (type=coordinator,host=xl2, port=5432);alter node coord1 with (type=coordinator,host=xl1, port=5432);alter node coord2 with (type=coordinator,host=xl2, port=5432);create node datanode1 with (type=datanode, host=xl1,port=15432,primary=true,PREFERRED);create node datanode2 with (type=datanode, host=xl2,port=15432);alter node datanode1 with (type=datanode, host=xl1,port=15432,primary=true,PREFERRED);alter node datanode2 with (type=datanode, host=xl2,port=15432);select pgxc_pool_reload(); 分别登陆数据节点、协调器节点验证 postgres= select from pgxc_node;node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id-----------+-----------+-----------+-----------+----------------+------------------+-------------coord1 | C | 5432 | xl1 | f | f | 1885696643coord2 | C | 5432 | xl2 | f | f | -1197102633datanode2 | D | 15432 | xl2 | f | f | -905831925datanode1 | D | 15432 | xl1 | t | f | 888802358(4 rows) 测试 插入数据 在数据节点1,执行相关操作。 通过协调器端口登录PG [postgres@xl1 ~]$ psql -p 5432psql (PGXL 10r1.1, based on PG 10.6 (Postgres-XL 10r1.1))Type "help" for help.postgres= create database lei;CREATE DATABASEpostgres= \c lei;You are now connected to database "lei" as user "postgres".lei= create table test1(id int,name text);CREATE TABLElei= insert into test1(id,name) select generate_series(1,8),'测试';INSERT 0 8lei= select from test1;id | name----+------1 | 测试2 | 测试5 | 测试6 | 测试8 | 测试3 | 测试4 | 测试7 | 测试(8 rows) 注:默认创建的表为分布式表,也就是每个数据节点值存储表的部分数据。关于表类型具体说明,下面有说明。 通过15432端口登录数据节点,查看数据 有5条数据 [postgres@xl1 ~]$ psql -p 15432psql (PGXL 10r1.1, based on PG 10.6 (Postgres-XL 10r1.1))Type "help" for help.postgres= \c lei;You are now connected to database "lei" as user "postgres".lei= select from test1;id | name----+------1 | 测试2 | 测试5 | 测试6 | 测试8 | 测试(5 rows) 登录到节点2,查看数据 有3条数据 [postgres@xl2 ~]$ psql -p15432psql (PGXL 10r1.1, based on PG 10.6 (Postgres-XL 10r1.1))Type "help" for help.postgres= \c lei;You are now connected to database "lei" as user "postgres".lei= select from test1;id | name----+------3 | 测试4 | 测试7 | 测试(3 rows) 两个节点的数据加起来整个8条,没有问题。 至此Postgre-XL集群搭建完成。 创建数据库、表时可能会出现以下错误: ERROR: Failed to get pooled connections 是因为pg_hba.conf配置不对,所有节点加上host all all 192.168.20.0/0 trust并重启集群即可。 ERROR: No Datanode defined in cluster 首先确认是否创建了数据节点,也就是create node相关的命令。如果创建了则执行select pgxc_pool_reload();使其生效即可。 集群管理与应用 表类型说明 REPLICATION表:各个datanode节点中,表的数据完全相同,也就是说,插入数据时,会分别在每个datanode节点插入相同数据。读数据时,只需要读任意一个datanode节点上的数据。 建表语法: CREATE TABLE repltab (col1 int, col2 int) DISTRIBUTE BY REPLICATION; DISTRIBUTE :会将插入的数据,按照拆分规则,分配到不同的datanode节点中存储,也就是sharding技术。每个datanode节点只保存了部分数据,通过coordinate节点可以查询完整的数据视图。 CREATE TABLE disttab(col1 int, col2 int, col3 text) DISTRIBUTE BY HASH(col1); 模拟数据插入 任意登录一个coordinate节点进行建表操作 [postgres@gtm ~]$ psql -h xl1 -p 5432 -U postgrespostgres= INSERT INTO disttab SELECT generate_series(1,100), generate_series(101, 200), 'foo';INSERT 0 100postgres= INSERT INTO repltab SELECT generate_series(1,100), generate_series(101, 200);INSERT 0 100 查看数据分布结果: DISTRIBUTE表分布结果 postgres= SELECT xc_node_id, count() FROM disttab GROUP BY xc_node_id;xc_node_id | count ------------+-------1148549230 | 42-927910690 | 58(2 rows) REPLICATION表分布结果 postgres= SELECT count() FROM repltab;count -------100(1 row) 查看另一个datanode2中repltab表结果 [postgres@datanode2 pgxl9.5]$ psql -p 15432psql (PGXL 10r1.1, based on PG 10.6 (Postgres-XL 10r1.1))Type "help" for help.postgres= SELECT count() FROM repltab;count -------100(1 row) 结论:REPLICATION表中,datanode1,datanode2中表是全部数据,一模一样。而DISTRIBUTE表,数据散落近乎平均分配到了datanode1,datanode2节点中。 新增数据节点与数据重分布 在线新增节点、并重新分布数据。 新增datanode节点 在gtm集群管理节点上执行pgxc_ctl命令 [postgres@gtm ~]$ pgxc_ctl/bin/bashInstalling pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Installing pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.Reading configuration using /home/postgres/pgxc_ctl/pgxc_ctl_bash --home /home/postgres/pgxc_ctl --configuration /home/postgres/pgxc_ctl/pgxc_ctl.confFinished reading configuration. PGXC_CTL START Current directory: /home/postgres/pgxc_ctlPGXC 在服务器xl3上,新增一个master角色的datanode节点,名称是datanode3 端口号暂定5430,pool master暂定6669 ,指定好数据目录位置,从两个节点升级到3个节点,之后要写3个none none应该是datanodeSpecificExtraConfig或者datanodeSpecificExtraPgHba配置PGXC add datanode master datanode3 xl3 15432 6671 /home/postgres/pgxc/nodes/datanode/datanode3 none none none 等待新增完成后,查询集群节点状态: postgres= select from pgxc_node;node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id-----------+-----------+-----------+-----------+----------------+------------------+-------------datanode1 | D | 15432 | xl1 | t | f | 888802358datanode2 | D | 15432 | xl2 | f | f | -905831925datanode3 | D | 15432 | xl3 | f | f | -705831925coord1 | C | 5432 | xl1 | f | f | 1885696643coord2 | C | 5432 | xl2 | f | f | -1197102633(4 rows) 节点新增完毕 数据重新分布 由于新增节点后无法自动完成数据重新分布,需要手动操作。 DISTRIBUTE表分布在了node1,node2节点上,如下: postgres= SELECT xc_node_id, count() FROM disttab GROUP BY xc_node_id;xc_node_id | count ------------+-------1148549230 | 42-927910690 | 58(2 rows) 新增一个节点后,将sharding表数据重新分配到三个节点上,将repl表复制到新节点 重分布sharding表postgres= ALTER TABLE disttab ADD NODE (datanode3);ALTER TABLE 复制数据到新节点postgres= ALTER TABLE repltab ADD NODE (datanode3);ALTER TABLE 查看新的数据分布: postgres= SELECT xc_node_id, count() FROM disttab GROUP BY xc_node_id;xc_node_id | count ------------+--------700122826 | 36-927910690 | 321148549230 | 32(3 rows) 登录datanode3(新增的时候,放在了xl3服务器上,端口15432)节点查看数据: [postgres@gtm ~]$ psql -h xl3 -p 15432 -U postgrespsql (PGXL 10r1.1, based on PG 10.6 (Postgres-XL 10r1.1))Type "help" for help.postgres= select count() from repltab;count -------100(1 row) 很明显,通过 ALTER TABLE tt ADD NODE (dn)命令,可以将DISTRIBUTE表数据重新分布到新节点,重分布过程中会中断所有事务。可以将REPLICATION表数据复制到新节点。 从datanode节点中回收数据 postgres= ALTER TABLE disttab DELETE NODE (datanode3);ALTER TABLEpostgres= ALTER TABLE repltab DELETE NODE (datanode3);ALTER TABLE 删除数据节点 Postgresql-XL并没有检查将被删除的datanode节点是否有replicated/distributed表的数据,为了数据安全,在删除之前需要检查下被删除节点上的数据,有数据的话,要回收掉分配到其他节点,然后才能安全删除。删除数据节点分为四步骤: 1.查询要删除节点dn3的oid postgres= SELECT oid, FROM pgxc_node;oid | node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id -------+-----------+-----------+-----------+-----------+----------------+------------------+-------------11819 | coord1 | C | 5432 | datanode1 | f | f | 188569664316384 | coord2 | C | 5432 | datanode2 | f | f | -119710263316385 | node1 | D | 5433 | datanode1 | f | t | 114854923016386 | node2 | D | 5433 | datanode2 | f | f | -92791069016397 | dn3 | D | 5430 | datanode1 | f | f | -700122826(5 rows) 2.查询dn3对应的oid中是否有数据 testdb= SELECT FROM pgxc_class WHERE nodeoids::integer[] @> ARRAY[16397];pcrelid | pclocatortype | pcattnum | pchashalgorithm | pchashbuckets | nodeoids ---------+---------------+----------+-----------------+---------------+-------------------16388 | H | 1 | 1 | 4096 | 16397 16385 1638616394 | R | 0 | 0 | 0 | 16397 16385 16386(2 rows) 3.有数据的先回收数据 postgres= ALTER TABLE disttab DELETE NODE (dn3);ALTER TABLEpostgres= ALTER TABLE repltab DELETE NODE (dn3);ALTER TABLEpostgres= SELECT FROM pgxc_class WHERE nodeoids::integer[] @> ARRAY[16397];pcrelid | pclocatortype | pcattnum | pchashalgorithm | pchashbuckets | nodeoids ---------+---------------+----------+-----------------+---------------+----------(0 rows) 4.安全删除dn3 PGXC$ remove datanode master dn3 clean 故障节点FAILOVER 1.查看当前集群状态 [postgres@gtm ~]$ psql -h xl1 -p 5432psql (PGXL 10r1.1, based on PG 10.6 (Postgres-XL 10r1.1))Type "help" for help.postgres= SELECT oid, FROM pgxc_node;oid | node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id-------+-----------+-----------+-----------+-----------+----------------+------------------+-------------11739 | coord1 | C | 5432 | xl1 | f | f | 188569664316384 | coord2 | C | 5432 | xl2 | f | f | -119710263316387 | datanode2 | D | 15432 | xl2 | f | f | -90583192516388 | datanode1 | D | 15432 | xl1 | t | t | 888802358(4 rows) 2.模拟datanode1节点故障 直接关闭即可 PGXC stop -m immediate datanode master datanode1Stopping datanode master datanode1.Done. 3.测试查询 只要查询涉及到datanode1上的数据,那么该查询就会报错 postgres= SELECT xc_node_id, count() FROM disttab GROUP BY xc_node_id;WARNING: failed to receive file descriptors for connectionsERROR: Failed to get pooled connectionsHINT: This may happen because one or more nodes are currently unreachable, either because of node or network failure.Its also possible that the target node may have hit the connection limit or the pooler is configured with low connections.Please check if all nodes are running fine and also review max_connections and max_pool_size configuration parameterspostgres= SELECT xc_node_id, FROM disttab WHERE col1 = 3;xc_node_id | col1 | col2 | col3------------+------+------+-------905831925 | 3 | 103 | foo(1 row) 测试发现,查询范围如果涉及到故障的node1节点,会报错,而查询的数据范围不在node1上的话,仍然可以查询。 4.手动切换 要想切换,必须要提前配置slave节点。 PGXC$ failover datanode node1 切换完成后,查询集群 postgres= SELECT oid, FROM pgxc_node;oid | node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id -------+-----------+-----------+-----------+-----------+----------------+------------------+-------------11819 | coord1 | C | 5432 | datanode1 | f | f | 188569664316384 | coord2 | C | 5432 | datanode2 | f | f | -119710263316386 | node2 | D | 15432 | datanode2 | f | f | -92791069016385 | node1 | D | 15433 | datanode2 | f | t | 1148549230(4 rows) 发现datanode1节点的ip和端口都已经替换为配置的slave了。 本篇文章为转载内容。原文链接:https://blog.csdn.net/qianglei6077/article/details/94379331。 该文由互联网用户投稿提供,文中观点代表作者本人意见,并不代表本站的立场。 作为信息平台,本站仅提供文章转载服务,并不拥有其所有权,也不对文章内容的真实性、准确性和合法性承担责任。 如发现本文存在侵权、违法、违规或事实不符的情况,请及时联系我们,我们将第一时间进行核实并删除相应内容。
2023-01-30 11:09:03
94
转载
.net
...rp string connectionString = "Server=.;Database=MyDB;User ID=myUsername;Password=myPassword;"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); } 这段代码会抛出一个System.Data.SqlClient.SqlException异常,错误信息为“数据库' MyDB '不存在”。 2. 数据库不存在 如果我们的应用程序试图操作一个不存在的数据库,那么也会引发DatabaseNotFoundException。比如说,如果我们想要从一个叫做"MyDB"的数据库里捞点数据出来,但是这个数据库压根不存在,这时候,系统就会毫不犹豫地抛出一个异常来提醒我们。 csharp string connectionString = "Server=.;Database=MyDB;User ID=myUsername;Password=myPassword;"; using (SqlConnection connection = new SqlConnection(connectionString)) { string query = "SELECT FROM Customers"; using (SqlCommand command = new SqlCommand(query, connection)) { command.Connection.Open(); SqlDataReader reader = command.ExecuteReader(); // ... } } 这段代码会抛出一个System.Data.SqlClient.SqlException异常,错误信息为“由于空间不足,未能创建文件。” 3. SQL查询语法错误 如果我们的SQL查询语句有误,那么数据库服务器也无法执行它,从而抛出DatabaseNotFoundException。例如,如果我们试图执行一个错误的查询,如下面这样: csharp string connectionString = "Server=.;Database=MyDB;User ID=myUsername;Password=myPassword;"; using (SqlConnection connection = new SqlConnection(connectionString)) { string query = "SELECT FROm Customers"; using (SqlCommand command = new SqlCommand(query, connection)) { command.Connection.Open(); SqlDataReader reader = command.ExecuteReader(); // ... } } 这段代码会抛出一个System.Data.SqlClient.SqlException异常,错误信息为“无效的命令。” 三、解决方案 知道了问题的原因之后,我们就可以采取相应的措施来解决了。 1. 检查数据库连接字符串 如果我们的数据库连接字符串有误,那么就需要修改它。确保所有的参数都是正确的,并且服务器可以访问到。 2. 创建数据库 如果我们的数据库不存在,那么就需要先创建它。你可以在SQL Server Management Studio这个工具里头亲手创建一个新的数据库,就像在厨房里烹饪一道新菜一样。另外呢,如果你更喜欢编码的方式,也可以在.NET代码里运用SqlCreateDatabaseCommand这个类,像乐高积木搭建一样创造出你需要的数据库。 3. 检查SQL查询语法 如果我们的SQL查询语句有误,那么就需要修正它。瞧一瞧,确保所有关键词的拼写都没毛病哈,还有那些表的名字、字段名,甚至函数名啥的,都得瞅瞅是不是准确无误。 总的来说,解决DatabaseNotFoundException:找不到数据库。的问题需要我们先找出它的原因,然后再针对性地进行修复。希望这篇小文能够帮助你更好地理解和解决这个问题。
2023-03-03 21:05:10
415
岁月如歌_t
Mongo
...ngoClient.connect(uri, { useNewUrlParser: true, useUnifiedTopology: true }, (err, client) => { if (err) throw err; console.log("Connected to MongoDB"); const db = client.db('test'); // ...接下来进行查询和操作 }); 三、聚合框架基础 MongoDB的聚合框架(Aggregation Framework)是一个用于处理数据流的强大工具,它允许我们在服务器端进行复杂的计算和分析,而无需将所有数据传输回应用。基础的聚合操作包括$match、$project、$group等。例如,我们想找出某个集合中年龄大于30的用户数量: javascript db.users.aggregate([ { $match: { age: { $gt: 30 } } }, { $group: { _id: null, count: { $sum: 1 } } } ]).toArray(); 四、管道操作与复杂查询 聚合管道是一系列操作的序列,它们依次执行,形成了一个数据处理流水线。比如,我们可以结合$sort和$limit操作,获取年龄最大的前10位用户: javascript db.users.aggregate([ { $sort: { age: -1 } }, { $limit: 10 } ]).toArray(); 五、自定义聚合函数 MongoDB提供了很多预定义的聚合函数,如$avg、$min等。然而,如果你需要更复杂的计算,可以使用$function,定义一个JavaScript函数来执行自定义逻辑。例如,计算用户的平均购物金额: javascript db.orders.aggregate([ { $unwind: "$items" }, { $group: { _id: "$user_id", avgAmount: { $avg: "$items.price" } } } ]); 六、聚合管道优化 在处理大量数据时,优化聚合管道性能至关重要。你知道吗,有时候处理数据就像打游戏,我们可以用"$lookup"这个神奇的操作来实现内连,就像角色之间的无缝衔接。或者,如果你想给你的数据找个新家,别担心内存爆炸,用"$out"就能轻松把结果导向一个全新的数据仓库,超级方便!记得定期检查$explain()输出,了解每个阶段的性能瓶颈。 七、结论 MongoDB的聚合框架就像一把瑞士军刀,能处理各种数据处理需求。亲身体验和深度研习后,你就会发现这家伙的厉害之处,不只在于它那能屈能伸的灵巧,更在于它处理海量数据时的神速高效,简直让人惊叹!希望这些心得能帮助你在探索MongoDB的路上少走弯路,享受数据处理的乐趣。 记住,每一种技术都有其独特魅力,关键在于如何发掘并善用。加油,让我们一起在MongoDB的世界里探索更多可能!
2024-04-01 11:05:04
139
时光倒流
转载文章
...客户端运行服务器端的函数来返回一个字符串的值。当服务器端回应了,客户端的回应函数在label上显示字符传。客户端通过改变Button的label来断开连接。当diaconnect的按钮被点击,客户端断开连接,并且清空label。 ONE.创建用户界面 1.开启Flash CS3,然后选择新建>flash文件(ActionScript 3.0)。 2.选择窗口>组件,然后选择User Interface>Button。在属性栏里面为按钮取名bt。 3.添加一个Label组件,移动它到按钮上面,取名为txt。 保存文件为test.fla。 TWO.建立as文件。 输入以下代码: package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.events.NetStatusEvent; import flash.net.NetConnection; import flash.net.Responder; public class Main extends MovieClip { public var nc:NetConnection; public var myRespond:Responder; public function Main():void { txt.text=""; bt.label="请点击链接"; myRespond=new Responder(success,failed); bt.addEventListener(MouseEvent.CLICK,clickHandler); } private function clickHandler(e:MouseEvent) { if (bt.label=="请点击链接") { bt.label="请点击断开"; nc=new NetConnection(); nc.connect("rtmp://localhost/viniFMS"); nc.addEventListener(NetStatusEvent.NET_STATUS,statusHandler); nc.call("sayServermsg",myRespond,"Hi"); } else { txt.text=""; bt.label="请点击链接"; nc.close(); } } private function statusHandler(e:NetStatusEvent) { if (e.info.code=="NetConnection.Connect.Success") { trace("ok"); } } private function success(result:Object) { trace("成功:"+result.toString()); txt.text=result.toString(); } private function failed(result:Object) { trace("失败:"+result.toString()); } } } 将as文件保存为Main.as 在test.fla的属性那的文档类输入Main。保存。 Three:建立通讯文件(.asc) 1.选择文件>新建>actionscript通信文件。 输入以下代码: application.onConnect=function(client){ application.acceptConnection(client); client.sayServermsg=function(msg){ return msg+",欢迎你来到FMS的世界 !"; } } 将文件保存到fms的application的文件夹下的viniFMS文件夹下,文件名为:main.asc. 确保FMS的服务已经打开,80端口没有被php等占用。 然后运行flash,点击按钮。就会有结果出现了。如下图所示。 再点击按钮。关闭连接。再点就是打开。如此循环。客户端会得到服务器端返回的 数据。 一个客户端用actionscript编码来连接到服务器,处理事件,和做其它工作。通过flash CS3你可以使用actionscript 3.0,2.0或1.0,但是actionscript3.0提供更多特性。要想使用flex,你必须使用actionscript 3.0. Actionscript3.0显著的不同于actionscript 2.0。这个向导假设你是在正在编写actionscript 3.0的类,这些类是一些外部的.as文件,有符合你的开发环境的目录结构的包的名称 转载于:https://blog.51cto.com/vini123/681426 本篇文章为转载内容。原文链接:https://blog.csdn.net/weixin_33895475/article/details/91647859。 该文由互联网用户投稿提供,文中观点代表作者本人意见,并不代表本站的立场。 作为信息平台,本站仅提供文章转载服务,并不拥有其所有权,也不对文章内容的真实性、准确性和合法性承担责任。 如发现本文存在侵权、违法、违规或事实不符的情况,请及时联系我们,我们将第一时间进行核实并删除相应内容。
2023-09-10 18:10:29
66
转载
Mongo
...ngoClient.connect(url, {useNewUrlParser: true}, (err, client) => { if (err) throw err; console.log("Connected to MongoDB"); const db = client.db(dbName); // ...进行数据库操作 client.close(); // 关闭连接 }); 2.2 异步与同步的区别 在上述代码中,MongoClient.connect函数会立即返回,即使连接尚未建立。这是因为它采用了异步模式,这样可以让你的代码继续执行,而不会阻塞。一旦连接成功,回调函数会被调用。这就是异步编程的魅力,它让我们的应用更加响应式。 三、异步写入 提升性能的关键 3.1 写入操作的异步性 当我们向MongoDB写入数据时,通常也采用异步方式,因为这可以避免阻塞主线程,尤其是在高并发环境下。例如,使用insertOne方法: javascript db.collection('users').insertOne({name: 'John Doe'}, (err, result) => { if (err) console.error(err); console.log(Inserted document with _id: ${result.insertedId}); }); 3.2 为什么要异步写入? 异步写入的优势在于,如果数据库正在处理其他请求,当前请求不会被阻塞,而是立即返回。这样,应用程序可以继续处理其他任务,提高了整体的吞吐量。 四、异步操作的处理与错误处理 4.1 错误处理 在异步操作中,错误通常通过回调函数传递。我们需要确保正确处理这些可能发生的异常,以便于应用程序的健壮性。 javascript db.collection('users').insertOne({name: 'Jane Doe'}, (err, result) => { if (err) { console.error('Error inserting document:', err); } else { console.log(Inserted document with _id: ${result.insertedId}); } }); 4.2 回调地狱与Promise/Async/Await 为了避免回调地狱,我们可以利用Promise、async/await等现代JavaScript特性来更优雅地处理异步操作。 javascript async function insertUser(user) { try { const result = await db.collection('users').insertOne(user); console.log(Inserted document with _id: ${result.insertedId}); } catch (error) { console.error('Error inserting document:', error); } } insertUser({name: 'Alice Smith'}); 五、结论 MongoDB的异步特性使得数据库操作更加高效,尤其在处理大规模数据和高并发场景下。你知道吗,只要咱们掌握了异步编程的窍门,灵活运用回调、Promise或者那个超好用的async/await,就能把MongoDB的大招完全发挥出来。这样一来,咱的应用程序不仅速度嗖嗖地提升,用户体验也能蹭蹭上涨,保证让用户用得爽歪歪!同时呢,异步操作这个小东西也悄悄告诉我们,在编程的过程中,咱可千万不能忽视代码的维护性和扩展性,毕竟业务需求这玩意儿是说变就变的,咱们得随时做好准备,让代码灵活适应这些变化。
2024-03-13 11:19:09
262
寂静森林_t
Python
...n.clicked.connect(self.translate_text) 布局设计 layout = QVBoxLayout() layout.addWidget(self.input_label) layout.addWidget(self.input_line) layout.addWidget(self.translate_button) self.setCentralWidget(layout) 在这个类中,我们定义了一个构造函数initUI,它主要负责创建窗口布局。我们还特意设计了一个叫做translate_text的方法,你就想象一下,当你轻轻一点那个“翻译”按钮的时候,这个方法就像被按下了启动开关,立马就开始工作啦! 五、运行程序 最后,我们需要在主函数中创建并显示窗口,并设置应用程序参数以便退出: python if __name__ == '__main__': app = QApplication(sys.argv) window = TranslateWindow() window.show() sys.exit(app.exec_()) 六、总结 Python是一种非常强大的语言,它可以用来做很多事情,包括桌面翻译。借助Google Translate API和其他翻译工具,我们能够轻轻松松、快速地搞定各种文本翻译任务,就像有了一个随身的翻译小助手一样方便。用PyQt5这类工具库,咱们就能轻松设计出美美的用户界面,让大伙儿使用起来更舒心、更享受。 这只是一个基础的示例,实际上,我们还可以添加更多的功能,例如保存翻译历史、支持更多语言等。希望这篇文章能帮助你更好地理解和使用Python进行桌面翻译。
2023-09-30 17:41:35
249
半夏微凉_t
转载文章
...tempts to connect to it with an older client may fail with the following message: shell> mysqlClient does not support authentication protocol requestedby server; consider upgrading MySQL client To solve this problem, you should use one of the following approaches: http://www.gaodaima.com/38584.htmlMYSQL 新版出现" Client does_mysql Upgrade all client programs to use a 4.1.1 or newer client library. When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password. Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function: mysql> SET PASSWORD FOR -> 'some_user'@'some_host' = OLD_PASSWORD('newpwd'); Alternatively, use UPDATE and FLUSH PRIVILEGES: mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') -> WHERE Host = 'some_host' AND User = 'some_user';mysql> FLUSH PRIVILEGES; Substitute the password you want to use for newpwd'' in the preceding examples. MySQL cannot tell you what the original password was, so you'll need to pick a new one. Tell the server to use the older password hashing algorithm: Start mysqld with the --old-passwords option. Assign an old-format password to each account that has had its password updated to the longer 4.1 format. You can identify these accounts with the following query: mysql> SELECT Host, User, Password FROM mysql.user -> WHERE LENGTH(Password) > 16; For each account record displayed by the query, use the Host and User values and assign a password using the OLD_PASSWORD() function and either SET PASSWORD or UPDATE, as described earlier. For additional background on password hashing and authentication, see section 5.5.9 Password Hashing in MySQL 4.1. 例子: SET PASSWORD FOR 用户名@localhost = OLD_PASSWORD('密码'); 欢迎大家阅读《MYSQL 新版出现" Client does_mysql》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码 微信 赏一包辣条吧~ 支付宝 赏一听可乐吧~ 本篇文章为转载内容。原文链接:https://blog.csdn.net/weixin_29363791/article/details/114779150。 该文由互联网用户投稿提供,文中观点代表作者本人意见,并不代表本站的立场。 作为信息平台,本站仅提供文章转载服务,并不拥有其所有权,也不对文章内容的真实性、准确性和合法性承担责任。 如发现本文存在侵权、违法、违规或事实不符的情况,请及时联系我们,我们将第一时间进行核实并删除相应内容。
2023-11-17 19:43:27
105
转载
站内搜索
用于搜索本网站内部文章,支持栏目切换。
知识学习
实践的时候请根据实际情况谨慎操作。
随机学习一条linux命令:
watch -n 5 'command'
- 定时执行命令并刷新输出结果(每5秒一次)。
推荐内容
推荐本栏目内的其它文章,看看还有哪些文章让你感兴趣。
2023-04-28
2023-08-09
2023-06-18
2023-04-14
2023-02-18
2023-04-17
2024-01-11
2023-10-03
2023-09-09
2023-06-13
2023-08-07
2023-03-11
历史内容
快速导航到对应月份的历史文章列表。
随便看看
拉到页底了吧,随便看看还有哪些文章你可能感兴趣。
时光飞逝
"流光容易把人抛,红了樱桃,绿了芭蕉。"