前端技术
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
[Bootstrap框架下拉菜单事件处理机...]的搜索结果
这里是文章列表。热门标签的颜色随机变换,标签颜色没有特殊含义。
点击某个标签可搜索标签相关的文章。
点击某个标签可搜索标签相关的文章。
转载文章
...stree.com bootstrap官方地址:https://v3.bootcss.com font-awesome官方地址:http://www.fontawesome.com.cn/faicons/ github项目地址:https://github.com/chengchuanqiang/jstreeDemo 2、jstreedemo主要文件 2.1、html页面代码 <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>jstree demo</title><link rel="stylesheet" href="jstree/dist/themes/default/style.min.css" /><link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-dist/css/bootstrap.min.css" /> <link rel="stylesheet" type="text/css" href="font-awesome-4.7.0/css/font-awesome.min.css" /> </head><body><div class="container"> <div class="row" style="height: 100px;"></div><div class="row"><div > <button class="btn btn-info" onclick="node_create()"> 新增 </button><button class="btn btn-info" onclick="node_rename()"> 编辑</button><button class="btn btn-info" onclick="node_delete()"> 删除</button></div></div><div class="row" style="height: 5px;"></div><div class="row"> <div class="col-md-3"> <!-- 描述:搜索框 --> <div class="input-group row"> <span class="input-group-addon" id="basic-addon1"><i class="glyphicon glyphicon-screenshot"></i></span> <input type="text" class="form-control" placeholder="请输入功能名称..." id="search_ay" aria-describedby="basic-addon1"> </div> <!--描述:jstree 树形菜单容器--> <div id="jstree_demo_div" class="row"> </div> </div> <div lass="col-md-9"> <button class="btn btn-tab" var='json/data.json'>data.json</button> <!--点击切换资源--> <button class="btn btn-tab" var='json/data2.json'>data2.json</button> <!--点击切换资源--> <button class="btn refresh "><i class="glyphicon glyphicon-refresh"></i></button> <!--点击刷新资源--> </div> </div> </div> <script src="jquery/jquery.min.js"></script><script src="jstree/dist/jstree.min.js"></script><script src="jstreeDemo.js?20180125"></script></body></html> 2.2、jstreeDemo.js代码 function jstree_fun(url){var $tree = $("jstree_demo_div").jstree({"core":{//'multiple': false, // 是否可以选择多个节点//"check_callback": true, // 允许拖动菜单 唯一 右键菜单"check_callback" : true,//设置为true,当用户修改数时,允许所有的交互和更好的控制(例如增删改)"themes" : { "stripes" : true },//主题配置对象,表示树背景是否有条带"data" : {//'url' : url,//'data' : function(node){//return { 'id' : node.id };//}"url" : url,"dataType" : "json"},"check_callback" : function(operation, node, node_parent, node_position, more){if(operation === "move_node"){var node = this.get_node(node_parent);if(node.id === ""){alert("根结点不可以删除");return false;}if(node.state.disabled){alert("禁用的不可以删除");return false;} }else if(operation === "delete_node"){var node = this.get_node(node_parent);if(node.id === ""){alert("根结点不可以删除");return false;} }return true;} },"plugins": [ //插件 "search", //允许插件搜索 // "sort", //排序插件 "state", //状态插件 "types", //类型插件 "unique", //唯一插件 "wholerow", //整行插件"contextmenu"],types:{ "default": { //设置默认的icon 图 "icon": "glyphicon glyphicon-folder-close", } } });$tree.on("open_node.jstree", function(e,data){ //监听打开事件var currentNode = data.node; data.instance.set_icon(currentNode, "glyphicon glyphicon-folder-open"); });$tree.on("close_node.jstree", function(e,data){ //监听关闭事件 var currentNode = data.node; data.instance.set_icon(currentNode, "glyphicon glyphicon-folder-close"); });$tree.on("activate_node.jstree", function(e, data){var currentNode = data.node; //获取当前节点的json .node //alert(currentNode.a_attr.id) //alert(currentNode.a_attr.href) //获取超链接的 .a_attr.href "链接" .a_attr.id ID //alert(currentNode.li_attr.href) //获取属性的 .li_attr.href "链接" .li_attr.id ID });// 创建$tree.on("create_node.jstree", function(e, data){alert("创建node节点");});// 修改$tree.on("rename_node.jstree", function(e, data){alert("修改node节点");});// 删除$tree.on("delete_node.jstree", function(e, data){alert("删除node节点");});// 查询节点名称var to = false;$("search_ay").keyup(function(){if(to){clearTimeout(to);}to = setTimeout(function(){$tree.jstree(true).search($('search_ay').val()); //开启插件查询后 使用这个方法可模糊查询节点 },250);});$('.btn-tab').click(function(){ //选项事件 //alert($(this).attr("var")) $tree.jstree(true).destroy(); //可做联级 $tree = jstree_fun($(this).attr("var"));//可做联级 //alert($(this).attr("var")) }); $('.refresh').click(function(){ //刷新事件 $tree.jstree(true).refresh () }); return $tree; }function node_create(){var ref = $("jstree_demo_div").jstree(true);var sel = ref.get_selected();if(!sel.length){alert("请先选择一个节点");return;}sel = sel[0];sel = ref.create_node(sel);if(sel){ref.edit(sel); } }function node_rename(){var ref = $("jstree_demo_div").jstree(true);var sel = ref.get_selected();if(!sel.length){alert("请先选择一个节点");return;}sel = sel[0];ref.edit(sel);}function node_delete(){var ref = $("jstree_demo_div").jstree(true);var sel = ref.get_selected();if(!sel.length){alert("请先选择一个节点");return;}sel = sel[0];if(ref.get_node(sel).parent==''){alert("根节点不允许删除");return;}ref.delete_node(sel);}// 初始化操作function init(){var $tree = jstree_fun("json/data.json");}init(); 3、图片效果展示 本篇文章为转载内容。原文链接:https://blog.csdn.net/qq_27717967/article/details/79167605。 该文由互联网用户投稿提供,文中观点代表作者本人意见,并不代表本站的立场。 作为信息平台,本站仅提供文章转载服务,并不拥有其所有权,也不对文章内容的真实性、准确性和合法性承担责任。 如发现本文存在侵权、违法、违规或事实不符的情况,请及时联系我们,我们将第一时间进行核实并删除相应内容。
2023-09-08 13:23:58
53
转载
Kafka
一、引言 你是否在处理大规模数据时,考虑过如何保护你的Kafka资源?你知道吗,一种常见的方法是通过SASL身份验证和授权来保护Kafka资源。今天,咱们就一起唠唠如何运用这个小妙招来守护我们的Kafka资源吧! 二、什么是SASL? SASL全称是简单认证和安全层(Simple Authentication and Security Layer),是一种提供客户端和服务器之间安全连接的方法。它可以用于在应用层进行身份验证和加密通信。 三、如何在Kafka中使用SASL? 首先,你需要安装并配置一个支持SASL的Kafka版本。接下来,你得捣鼓一下SASL的相关配置了,这包括挑选你要用的SASL验证机制、确定认证方式,还有别忘了填上用户名和密码这些重要信息。以下是一个简单的Java示例: java Properties props = new Properties(); props.put("bootstrap.servers", "localhost:9092"); props.put("sasl.mechanism", "PLAIN"); props.put("security.protocol", "SASL_SSL"); props.put("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"your-username\" password=\"your-password\";"); 四、SASL的两种模式 SASL有两种工作模式:ANONYMOUS和LOGIN。在ANONYMOUS模式下,你完全不需要进行身份验证这个步骤,就像是个隐形人一样自由进出。但是切换到LOGIN模式时,那就得像我们日常生活中那样,先亮出你的身份证明,完成验证后才能顺利登录。 五、如何通过SASL授权保护Kafka资源? 除了身份验证外,我们还需要对Kafka资源进行授权。Kafka提供了基于角色的访问控制(Role-Based Access Control,简称RBAC)来实现这一点。你可以定义角色,并为角色分配权限。例如: json { "version": 1, "cluster_name": "my_cluster", "authorizer_class_names": ["kafka.security.auth.SimpleAclAuthorizer"], "default_acls": [ { "host": "", "operation": "[\"DescribeTopics\",\"CreateTopics\"]", "permission_type": "Allow", "principal": "User:Alice" }, { "host": "", "operation": "[\"DescribeGroups\",\"ListConsumer\",\"DescribeConsumer\"]", "permission_type": "Deny", "principal": "User:Bob" } ] } 在这个示例中,Alice被允许创建和描述主题,而Bob则被拒绝执行这些操作。 六、结论 SASL身份验证和授权是保护Kafka资源的重要手段。要是把SASL给整对了,咱们就能妥妥地挡掉那些没经过许可就想偷偷摸摸访问和操作的小动作。在实际操作的时候,我们得看情况,瞅准需求和环境,像变戏法一样灵活挑选并设置SASL的各种参数和选项。 七、小结 希望通过这篇文章,你能更好地了解如何通过SASL身份验证和授权来保护Kafka资源。如果你还有任何问题,欢迎留言交流。让我们一起探索更多有趣的Kafka知识!
2023-09-20 20:50:41
482
追梦人-t
Bootstrap
... 在移动设备上优化 Bootstrap 表格的显示:一个全面指南 引言 在当今的网页设计世界里,适应性和响应性是关键要素。哎呀,你瞧这移动设备用得越来越普遍了,出门在外,手机、平板啥的都成了我们随身的小伙伴。所以啊,咱们在设计网站或者网页内容的时候,就得好好下点功夫,确保不管是在大屏幕的电脑上,还是小屏幕的手机上,都能看得舒舒服服,顺眼又顺手。这样子,不管是看新闻、逛商城还是查资料,用户都能有个好心情,咱们的网站也就更受欢迎啦!哎呀,Bootstrap这个家伙可真够厉害的!它就像是个超级英雄,专门给咱们前端开发大神们提供了一大堆牛逼哄哄的工具和组件。就拿它来搭建响应式网站来说吧,那简直就是分分钟的事儿,轻轻松松就能搞定,让网站在各种设备上都能完美展示,大小屏幕无缝切换,简直不要太爽!本文将深入探讨如何利用 Bootstrap 的特性,特别是在移动设备上优化表格的显示,使之既美观又实用。 Bootstrap 基础知识回顾 Bootstrap 提供了一系列用于构建响应式网页的预定义类和组件,包括表格。Bootstrap 的表格组件允许你轻松地创建结构良好的表格,同时保证其在不同设备上的可读性和美观性。基本的表格可以通过 1. 使用响应式表格容器 元素结合 Bootstrap 的类来创建,如 .table 用于提供基础样式,.table-responsive 则用于包裹在需要滚动的表格内,以适应小屏幕设备。 移动设备优先原则Bootstrap 的核心理念之一是“移动设备优先”,这意味着首先考虑在小屏幕上展示内容,并确保其可用性。对于表格而言,这意味着我们需要特别注意其在手机和平板等小屏幕设备上的表现。以下是几个关键步骤来优化 Bootstrap 表格在移动设备上的显示: html 姓名 职位 部门 张三 工程师 研发部 2. 使用折叠显示 当表格内容过多时,可以采用折叠显示机制,仅显示部分数据,用户点击后显示完整列表。这可以通过 JavaScript 或 Bootstrap 的插件实现,如 bootstrap-table 提供的滚动功能。 html 3. 优化视觉体验 使用 Bootstrap 的颜色、字体和间距类来增强表格的视觉吸引力。例如,可以为表格添加阴影效果,使其在小屏幕设备上更加突出。 html 4. 自定义分页和排序 对于大型数据集,提供分页和排序选项是必要的。Bootstrap 和其他前端库提供了丰富的插件来实现这一功能,使得用户能够方便地浏览大量数据。 html Total: { { total } } 刷新 排序 结论 优化 Bootstrap 表格在移动设备上的显示是一个综合性的任务,涉及到响应式设计、交互元素的加入以及用户体验的提升。嘿,朋友们!想要让你的网站在手机和平板上也超棒吗?那就得看看我这招啦!通过采用一些聪明的策略和实际的代码实例,你可以让网页在大屏幕和小屏幕上都玩得转!不管是在手机上滑来滑去,还是在平板上轻轻触碰,都能给你带来顺畅、清晰又易用的体验。这样一来,无论用户是用手机还是平板,都能享受到你的网站带来的乐趣!所以,别再犹豫了,快去试试吧!记住,设计的目标始终是让信息清晰、易于访问,无论用户是在哪里查看。随着技术的不断进步,这些优化方法也将不断发展和完善,因此持续学习和实践是保持网站适应性的重要途径。
2024-08-06 15:52:25
39
烟雨江南
Apache Atlas
...fka等)集成的一种机制。有了这些“钩子”,Atlas就能在一旁盯着目标系统的一举一动,还能自动记下相关的各种小细节。 举个例子,如果你有一个Hive表被创建了,Atlas可以通过Hive Hook实时记录下这个事件,包括表名、字段定义、所属数据库等信息。这么做的好处嘛,简直不要太明显!就好比给你的数据加上了一个“出生证”和“护照”,不仅能随时知道它是从哪儿来的、去过哪儿,还能记录下它一路上经历的所有变化。这样一来,管理起来就方便多了,也不用担心数据会“走丢”或者被搞砸啦! 然而,正因如此,Hook的部署显得尤为重要。要是Hook没装好,那Atlas就啥元数据也收不到啦,整个数据治理的工作就得卡在那里干瞪眼了。这也是为什么当我的Hook部署失败时,我会感到特别沮丧的原因。 --- 3. 部署失败 从错误日志中寻找线索 那么,Hook到底为什么会部署失败呢?为了找出答案,我打开了Atlas的日志文件,开始逐行分析那些晦涩难懂的错误信息。说实话,第一次看这些日志的时候,我直接傻眼了,那感觉就跟对着一堆乱码似的,完全摸不着头脑。 不过,经过一番耐心的研究,我发现了一些关键点。比如: - 依赖冲突:有些情况下,Hook可能会因为依赖的某些库版本不兼容而导致加载失败。 - 配置错误:有时候,我们可能在application.properties文件中漏掉了必要的参数设置。 - 权限不足:Hook需要访问目标系统的API接口,但如果权限配置不当,自然会报错。 为了验证我的猜测,我决定先从最简单的配置检查做起。打开atlas-application.properties文件,我仔细核对了以下内容: properties atlas.hook.kafka.enabled=true atlas.hook.kafka.consumer.group=atlas-kafka-group atlas.kafka.bootstrap.servers=localhost:9092 确认无误后,我又检查了Kafka服务是否正常运行,确保Atlas能够连接到它。虽然这一系列操作看起来很基础,但它们往往是排查问题的第一步。 --- 4. 实战演练 动手修复Hook部署失败 接下来,让我们一起动手试试如何修复Hook部署失败吧!首先,我们需要明确一点:问题的根源可能有很多,因此我们需要分步骤逐一排除。 Step 1: 检查依赖关系 假设我们的Hook是基于Hive的,那么首先需要确保Hive的客户端库已经正确添加到了项目中。例如,在Maven项目的pom.xml文件里,我们应该看到类似如下的配置: xml org.apache.hive hive-jdbc 3.1.2 如果版本不对,或者缺少了必要的依赖项,就需要更新或补充。记得每次修改完配置后都要重新构建项目哦! Step 2: 调试日志级别 为了让日志更加详细,帮助我们定位问题,可以在log4j.properties文件中将日志级别调整为DEBUG级别: properties log4j.rootLogger=DEBUG, console 这样做虽然会让日志输出变得冗长,但却能为我们提供更多有用的信息。 Step 3: 手动测试连接 有时候,Hook部署失败并不是代码本身的问题,而是网络或者环境配置出了差错。这时候,我们可以尝试手动测试一下Atlas与目标系统的连接情况。例如,对于Kafka Hook,可以用下面的命令检查是否能正常发送消息: bash kafka-console-producer.sh --broker-list localhost:9092 --topic test-topic 如果这条命令执行失败,那就可以确定是网络或者Kafka服务的问题了。 --- 5. 总结与反思 成长中的点滴收获 经过这次折腾,我对Apache Atlas有了更深的理解,同时也意识到,任何技术工具都不是万能的,都需要我们投入足够的时间和精力去学习和实践。 最后想说的是,尽管Hook部署失败的经历让我一度感到挫败,但它也教会了我很多宝贵的经验。比如: - 不要害怕出错,错误往往是进步的起点; - 日志是排查问题的重要工具,要学会善加利用; - 团队合作很重要,遇到难题时不妨寻求同事的帮助。 希望这篇文章对你有所帮助,如果你也有类似的经历或见解,欢迎随时交流讨论!我们一起探索技术的世界,共同进步!
2025-04-03 16:11:35
60
醉卧沙场
Kafka
...数次了。它是分布式流处理平台的代名词,一个开源的消息队列系统。Kafka这东西啊,最早是LinkedIn那边捣鼓出来的,后来觉得挺好,就把它送给了Apache基金会。没想到吧,就这么一送,它现在在大数据圈子里混得那叫一个风生水起,已经成了整个生态里头离不开的重要角色啦! 作为一个开发者,我对Kafka的第一印象是它超级可靠。无论是高吞吐量、低延迟还是容错能力,Kafka都表现得非常出色。大家有没有想过啊,“可靠”这个词到底是怎么来的?为啥说某个东西“靠谱”,我们就觉得它值得信赖呢?今天咱们就来聊聊这个事儿——比如说,你发出去的消息,咋就能保证它不会石沉大海、人间蒸发了呢?这可不是开玩笑的事儿,尤其是在大数据的世界里,丢一个消息可能就意味着丢了一笔订单或者错过了一次重要沟通。所以啊,今天我们就要揭开谜底,跟大家唠唠Kafka是怎么做到让消息“稳如老狗”的! 2. Kafka可靠性背后的秘密武器 Kafka的可靠性主要依赖于以下几个核心概念: 2.1 持久化与日志结构 Kafka将所有数据存储在日志文件中,并通过持久化机制确保数据不会因为服务器宕机而丢失。简单来说,就是把消息写入磁盘而不是内存。 java Properties props = new Properties(); props.put("bootstrap.servers", "localhost:9092"); props.put("acks", "all"); props.put("retries", 0); props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); Producer producer = new KafkaProducer<>(props); producer.send(new ProducerRecord<>("my-topic", "my-key", "my-value")); producer.close(); 这段代码展示了如何发送一条消息到Kafka主题。其中acks="all"参数表示生产者会等待所有副本确认收到消息后才认为发送成功。 2.2 分区与副本机制 Kafka通过分区(Partition)来分摊负载,同时通过副本(Replica)机制来提高可用性和容错性。每个分区可以有多个副本,其中一个为主副本,其余为从副本。 java AdminClient adminClient = AdminClient.create(props); ListTopicsOptions options = new ListTopicsOptions(); options.listInternal(true); Set topics = adminClient.listTopics(options).names().get(); System.out.println("Topics: " + topics); 这段代码用于列出Kafka集群中的所有主题及其副本信息。通过这种方式,你可以检查每个主题的副本分布情况。 3. 生产者端的可靠性保障 作为生产者,我们需要确保发送出去的消息能够安全到达Kafka集群。这涉及到一些关键配置: - acks:控制生产者的确认级别。设置为"all"时,意味着必须等待所有副本确认。 - retries:指定重试次数。如果网络抖动导致消息未送达,Kafka会自动重试。 - linger.ms:控制批量发送的时间间隔。默认值为0毫秒,即立即发送。 java Properties props = new Properties(); props.put("bootstrap.servers", "localhost:9092"); props.put("acks", "all"); props.put("retries", 3); props.put("linger.ms", 5); props.put("batch.size", 16384); Producer producer = new KafkaProducer<>(props); for (int i = 0; i < 100; i++) { producer.send(new ProducerRecord<>("my-topic", Integer.toString(i), Integer.toString(i))); } producer.close(); 在这个例子中,我们设置了retries=3和linger.ms=5,这意味着即使遇到短暂的网络问题,Kafka也会尝试最多三次重试,并且会在5毫秒内累积多条消息一起发送。 4. 消费者端的可靠性保障 消费者端同样需要关注可靠性问题。Kafka 有两种消费模式,一个叫 earliest,一个叫 latest。简单来说,earliest 就是从头开始补作业,把之前没看过的消息全都读一遍;而 latest 则是直接从最新的消息开始看,相当于跳过之前的存档,直接进入直播频道。 java Properties props = new Properties(); props.put("bootstrap.servers", "localhost:9092"); props.put("group.id", "test-group"); props.put("enable.auto.commit", "true"); props.put("auto.commit.interval.ms", "1000"); props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); KafkaConsumer consumer = new KafkaConsumer<>(props); consumer.subscribe(Arrays.asList("my-topic")); while (true) { ConsumerRecords records = consumer.poll(Duration.ofMillis(100)); for (ConsumerRecord record : records) { System.out.printf("offset = %d, key = %s, value = %s%n", record.offset(), record.key(), record.value()); } } 这段代码展示了如何订阅一个主题并持续拉取消息。注意这里启用了自动提交功能,这样就不需要手动管理偏移量了。 5. 总结与反思 通过今天的讨论,我相信大家对Kafka的消息可靠性有了更深的理解。Kafka能从一堆消息队列系统里脱颖而出,靠的就是它在设计的时候就脑补了各种“灾难片”场景,比如数据爆炸、服务器宕机啥的,然后还给配齐了神器,专门对付这些麻烦事儿。 然而,正如任何技术一样,Kafka也不是万能的。在实际应用中,我们还需要结合具体的业务需求来调整配置参数。比如说啊,在那种超级忙、好多请求同时涌过来的场景下,就得调整一下每次处理的任务量,别一下子搞太多,慢慢来可能更稳。但要是你干的事特别讲究速度,晚一秒钟都不行的那种,那就得想办法把发东西的时间间隔调短点,越快越好! 总之,Kafka的强大之处在于它允许我们灵活地调整策略以适应不同的工作负载。希望这篇文章能帮助你在实践中更好地利用Kafka的优势!如果你有任何疑问或想法,欢迎随时交流哦~
2025-04-11 16:10:34
95
幽谷听泉
转载文章
...,具有足够的灵活性来处理不同的数据库任务。 Postgres-XL功能特性 开放源代码:(源协议使用宽松的“Mozilla Public License”许可,允许将开源代码与闭源代码混在一起使用。) 完全的ACID支持 可横向扩展的关系型数据库(RDBMS) 支持OLAP应用,采用MPP(Massively Parallel Processing:大规模并行处理系统)架构模式 支持OLTP应用,读写性能可扩展 集群级别的ACID特性 多租户安全 也可被用作分布式Key-Value存储 事务处理与数据分析处理混合型数据库 支持丰富的SQL语句类型,比如:关联子查询 支持绝大部分PostgreSQL的SQL语句 分布式多版本并发控制(MVCC:Multi-version Concurrency Control) 支持JSON和XML格式 Postgres-XL缺少的功能 内建的高可用机制 使用外部机制实现高可能,如:Corosync/Pacemaker 有未来功能提升的空间 增加节点/重新分片数据(re-shard)的简便性 数据重分布(redistribution)期间会锁表 可采用预分片(pre-shard)方式解决,在同台物理服务器上建立多个数据节点,每个节点存储一个数据分片。数据重分布时,将一些数据节点迁出即可 某些外键、唯一性约束功能 Postgres-XL架构 [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-M9lFuEIP-1640133702200)(./assets/postgre-xl.jpg)] 基于开源项目Postgres-XC XL增加了MPP,允许数据节点间直接通讯,交换复杂跨节点关联查询相关数据信息,减少协调器负载。 多个协调器(Coordinator) 应用程序的数据库连入点 分析查询语句,生成执行计划 多个数据节点(DataNode) 实际的数据存储 数据自动打散分布到集群中各数据节点 本地执行查询 一个查询在所有相关节点上并行查询 全局事务管理器(GTM:Global Transaction Manager) 提供事务间一致性视图 部署GTM Proxy实例,以提高性能 Postgre-XL主要组件 GTM (Global Transaction Manager) - 全局事务管理器 GTM是Postgres-XL的一个关键组件,用于提供一致的事务管理和元组可见性控制。 GTM Standby GTM的备节点,在pgxc,pgxl中,GTM控制所有的全局事务分配,如果出现问题,就会导致整个集群不可用,为了增加可用性,增加该备用节点。当GTM出现问题时,GTM Standby可以升级为GTM,保证集群正常工作。 GTM-Proxy GTM需要与所有的Coordinators通信,为了降低压力,可以在每个Coordinator机器上部署一个GTM-Proxy。 Coordinator --协调器 协调器是应用程序到数据库的接口。它的作用类似于传统的PostgreSQL后台进程,但是协调器不存储任何实际数据。实际数据由数据节点存储。协调器接收SQL语句,根据需要获取全局事务Id和全局快照,确定涉及哪些数据节点,并要求它们执行(部分)语句。当向数据节点发出语句时,它与GXID和全局快照相关联,以便多版本并发控制(MVCC)属性扩展到集群范围。 Datanode --数据节点 用于实际存储数据。表可以分布在各个数据节点之间,也可以复制到所有数据节点。数据节点没有整个数据库的全局视图,它只负责本地存储的数据。接下来,协调器将检查传入语句,并制定子计划。然后,根据需要将这些数据连同GXID和全局快照一起传输到涉及的每个数据节点。数据节点可以在不同的会话中接收来自各个协调器的请求。但是,由于每个事务都是惟一标识的,并且与一致的(全局)快照相关联,所以每个数据节点都可以在其事务和快照上下文中正确执行。 Postgres-XL继承了PostgreSQL Postgres-XL是PostgreSQL的扩展并继承了其很多特性: 复杂查询 外键 触发器 视图 事务 MVCC(多版本控制) 此外,类似于PostgreSQL,用户可以通过多种方式扩展Postgres-XL,例如添加新的 数据类型 函数 操作 聚合函数 索引类型 过程语言 安装 环境说明 由于资源有限,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
转载
JQuery插件下载
...制作简单的响应式导航菜单”的浏览器插件,采用jQuery技术结合CSS3媒体查询实现了一款高度自适应的导航菜单解决方案。该插件专注于移动优先设计原则,为用户提供流畅的跨设备浏览体验。类似于Bootstrap框架下的导航菜单,它在设计上注重简洁与实用。当浏览器视口宽度小于760像素时,这款插件会智能地将常规展示的导航菜单转换为紧凑型的汉堡包菜单模式,隐藏大部分菜单项以节省空间,优化小屏幕设备上的内容布局。而在大屏幕或宽视口环境下,导航菜单则会展开并完整显示所有链接项目。通过整合JavaScript的强大交互能力和CSS3媒体查询的动态样式切换功能,此插件不仅确保了导航菜单在不同设备尺寸下的视觉一致性,还兼顾了用户的操作便捷性,是现代响应式网页设计中不可或缺的实用工具之一。 点我下载 文件大小:10.27 KB 您将下载一个JQuery插件资源包,该资源包内部文件的目录结构如下: 本网站提供JQuery插件下载功能,旨在帮助广大用户在工作学习中提升效率、节约时间。 本网站的下载内容来自于互联网。如您发现任何侵犯您权益的内容,请立即告知我们,我们将迅速响应并删除相关内容。 免责声明:站内所有资源仅供个人学习研究及参考之用,严禁将这些资源应用于商业场景。 若擅自商用导致的一切后果,由使用者承担责任。
2023-08-12 22:24:15
120
本站
JQuery插件下载
...y强大的DOM操作和事件处理功能,为用户提供了一个直观且高度交互的界面。用户能够轻松地以所见即所得的方式自定义网页上的导航图片顺序,只需简单地通过鼠标拖拽图片元素,即可随心所欲地进行排列组合。此插件极大地提升了用户体验,尤其在需要灵活调整布局或内容顺序的场景中,例如网站导航菜单、作品集展示、商品陈列等。其背后的核心技术使得拖拽过程流畅且响应迅速,确保在用户操作过程中,导航图片可以实时更新位置并自动保存排序结果,实现了真正意义上的动态布局管理。总之,这款jQuery拖拽排序插件是一个强大且实用的工具,它赋予了开发者便捷构建具有高度个性化和动态调整能力的网页组件的能力,让用户能够在视觉和功能上同时获得优质的体验。 点我下载 文件大小:267.77 KB 您将下载一个JQuery插件资源包,该资源包内部文件的目录结构如下: 本网站提供JQuery插件下载功能,旨在帮助广大用户在工作学习中提升效率、节约时间。 本网站的下载内容来自于互联网。如您发现任何侵犯您权益的内容,请立即告知我们,我们将迅速响应并删除相关内容。 免责声明:站内所有资源仅供个人学习研究及参考之用,严禁将这些资源应用于商业场景。 若擅自商用导致的一切后果,由使用者承担责任。
2024-02-23 19:51:59
107
本站
JQuery插件下载
...插件,它通过绑定滚动事件,为开发者提供了便捷的方式来实现炫酷的页面滚动动画效果。该插件的核心功能是预置了一系列与滚动相关的事件处理程序,这些事件会在用户滚动浏览页面内容时自动触发。使用jquery.scrollex,开发人员可以轻松指定任意元素,在页面滚动到特定位置时启动自定义动画或过渡效果,例如淡入淡出、位移变化、尺寸调整等。这不仅有助于提升网站视觉吸引力,还能引导用户的浏览焦点,强化信息层次和故事叙述。只需简单地调用该插件并配置相应的选项,即可在不同滚动位置添加丰富的动态响应,无需深入理解复杂的滚动监听和动画编程逻辑。因此,无论是在单页应用中创建沉浸式滚动体验,还是为多级导航菜单、图片画廊等内容区域增添生动效果,jquery.scrollex都是一个强大且高效的工具选择。 点我下载 文件大小:53.00 KB 您将下载一个JQuery插件资源包,该资源包内部文件的目录结构如下: 本网站提供JQuery插件下载功能,旨在帮助广大用户在工作学习中提升效率、节约时间。 本网站的下载内容来自于互联网。如您发现任何侵犯您权益的内容,请立即告知我们,我们将迅速响应并删除相关内容。 免责声明:站内所有资源仅供个人学习研究及参考之用,严禁将这些资源应用于商业场景。 若擅自商用导致的一切后果,由使用者承担责任。
2023-11-09 17:22:45
139
本站
JQuery插件下载
...Query插件介绍 BootstrapContextMenu是一款专为Web开发设计的jQuery插件,它充分利用了Bootstrap框架的样式和组件,为网页元素提供丰富的右键上下文菜单功能。这款插件具有高度定制性与易用性,允许开发者在多种类型的网页元素上轻松创建并绑定自定义的右键菜单,极大地增强了用户界面的交互体验。通过集成Bootstrap的设计规范,该插件能够无缝融入基于Bootstrap构建的项目中,保持界面风格的一致性。同时,它还支持与FontAwesome字体图标的结合使用,使得菜单项可以包含直观且美观的图标,提升菜单的表现力与可用性。BootstrapContextMenu插件提供了灵活的触发机制,无论是文本、图片、按钮还是其他自定义区域,只需简单配置,即可实现在这些元素上右键点击时展示相应的菜单选项。此外,菜单的位置计算精准,可自动适应屏幕尺寸与元素位置,确保在任何环境下都能给用户提供舒适的操作环境。总之,BootstrapContextMenu是一个强大而实用的工具,简化了开发过程中的上下文菜单实现步骤,并能帮助开发者快速打造出专业且响应式的Web应用界面。 点我下载 文件大小:351.42 KB 您将下载一个JQuery插件资源包,该资源包内部文件的目录结构如下: 本网站提供JQuery插件下载功能,旨在帮助广大用户在工作学习中提升效率、节约时间。 本网站的下载内容来自于互联网。如您发现任何侵犯您权益的内容,请立即告知我们,我们将迅速响应并删除相关内容。 免责声明:站内所有资源仅供个人学习研究及参考之用,严禁将这些资源应用于商业场景。 若擅自商用导致的一切后果,由使用者承担责任。
2023-01-24 14:47:30
90
本站
JQuery插件下载
...本框中的关键字搜索,下拉菜单的选择,单选按钮和多选按钮的切换等。这意味着无论你是想根据特定类别浏览图片,还是想要查找符合某些特定属性的内容,都可以轻松实现。此外,“jQuery超实用内容过滤器插件”还提供了高度自定义的可能性,开发者可以根据自己的需求调整样式和行为,以适应不同的项目要求。无论是个人博客、电商网站还是图片展示平台,这款插件都能发挥其强大的功能,帮助用户更便捷地管理和访问内容。总之,“jQuery超实用内容过滤器插件”以其易用性、灵活性以及出色的性能表现,成为网页开发者在处理大量图片和内容时的理想选择。 点我下载 文件大小:104.54 KB 您将下载一个JQuery插件资源包,该资源包内部文件的目录结构如下: 本网站提供JQuery插件下载功能,旨在帮助广大用户在工作学习中提升效率、节约时间。 本网站的下载内容来自于互联网。如您发现任何侵犯您权益的内容,请立即告知我们,我们将迅速响应并删除相关内容。 免责声明:站内所有资源仅供个人学习研究及参考之用,严禁将这些资源应用于商业场景。 若擅自商用导致的一切后果,由使用者承担责任。
2025-01-09 20:41:53
36
本站
JQuery插件下载
...t.js提供了丰富的事件回调机制,方便开发者根据用户行为进行定制化处理,如选择状态变更、展开折叠节点等操作。总之,folderselect.js是一个功能强大且极具创新性的jQuery复选框美化插件,它不仅提升了复选框的美观度,更极大地增强了其实用性和交互性,在Web开发中尤其适用于构建复杂的多级选择菜单或组织架构管理场景。 点我下载 文件大小:54.40 KB 您将下载一个JQuery插件资源包,该资源包内部文件的目录结构如下: 本网站提供JQuery插件下载功能,旨在帮助广大用户在工作学习中提升效率、节约时间。 本网站的下载内容来自于互联网。如您发现任何侵犯您权益的内容,请立即告知我们,我们将迅速响应并删除相关内容。 免责声明:站内所有资源仅供个人学习研究及参考之用,严禁将这些资源应用于商业场景。 若擅自商用导致的一切后果,由使用者承担责任。
2023-08-06 11:05:00
226
本站
JQuery插件下载
...且用户友好的商城导航菜单。它采用jQuery框架开发,旨在增强用户体验,让用户能够轻松浏览和查找商品。此插件的最大特色在于其独特的商品分类侧边栏列表设计,使得商品分类一目了然,用户只需点击左侧的下拉菜单,即可快速查看各种商品的详细列表。更值得一提的是,这款插件特别考虑到了兼容性问题,确保在IE8等旧版浏览器中也能正常工作,满足了更多用户的浏览需求。对于希望提升网站用户体验,尤其是需要支持多种浏览器环境的电商网站开发者来说,这款插件无疑是一个理想的选择。其简洁明了的设计风格和强大的功能性,不仅提升了用户的购物体验,还大大简化了商品浏览的过程,使用户能够更加便捷地找到自己所需的商品。此外,这款插件易于集成到现有的网站结构中,开发者可以根据实际需要进行自定义调整,以适应不同电商平台的独特需求。无论是小型个人店铺还是大型综合商城,都能通过这款插件获得显著的用户体验提升,从而推动销售增长,增加用户粘性。总之,这是一款结合了美观与实用性,同时兼顾技术兼容性的优秀jQuery商城导航菜单插件。 点我下载 文件大小:59.44 KB 您将下载一个JQuery插件资源包,该资源包内部文件的目录结构如下: 本网站提供JQuery插件下载功能,旨在帮助广大用户在工作学习中提升效率、节约时间。 本网站的下载内容来自于互联网。如您发现任何侵犯您权益的内容,请立即告知我们,我们将迅速响应并删除相关内容。 免责声明:站内所有资源仅供个人学习研究及参考之用,严禁将这些资源应用于商业场景。 若擅自商用导致的一切后果,由使用者承担责任。
2024-10-17 11:27:07
113
本站
JQuery插件下载
...大的jQuery大型下拉菜单插件,专为创建美观且功能丰富的导航系统而设计。这款插件能够帮助开发者轻松构建包含三列的大型下拉菜单,同时具备平滑的过渡效果和令人愉悦的鼠标滑过动画,提升用户体验。其简洁的API和高度可定制性使得集成过程极为顺畅,即使对于初学者而言也易于上手。在设计上,booNavigation旨在提供卓越的兼容性,确保在各种浏览器环境下都能稳定运行,特别是对于要求较高的IE8环境,它同样支持良好,确保所有用户都能享受到一致的体验。这使得开发者无需担心因浏览器差异而导致的功能或性能问题,专注于内容和设计的优化。借助booNavigation,开发者可以快速实现复杂的导航结构,如多级菜单、分组选项等,同时保持页面的响应速度和加载效率。插件内置的优化机制,如懒加载和动态渲染,进一步提升了用户体验,尤其是在移动设备和平板电脑上的表现。此外,booNavigation提供了丰富的自定义选项,允许开发者调整菜单的样式、布局和行为,以适应不同的网站主题和设计风格。从颜色、字体到过渡效果和交互模式,几乎所有的视觉和功能元素都可以根据需求进行定制,从而实现高度个性化的导航菜单。总之,booNavigation是一个功能强大、易于集成、高度兼容的jQuery大型下拉菜单插件,特别适合需要创建复杂导航结构的网站项目。无论是追求高性能的开发者,还是希望快速搭建美观导航系统的设计师,都能从中获益匪浅。通过使用这款插件,可以显著提升网站的用户体验,使其更加吸引人、易于导航,进而提高转化率和用户满意度。 点我下载 文件大小:44.24 KB 您将下载一个JQuery插件资源包,该资源包内部文件的目录结构如下: 本网站提供JQuery插件下载功能,旨在帮助广大用户在工作学习中提升效率、节约时间。 本网站的下载内容来自于互联网。如您发现任何侵犯您权益的内容,请立即告知我们,我们将迅速响应并删除相关内容。 免责声明:站内所有资源仅供个人学习研究及参考之用,严禁将这些资源应用于商业场景。 若擅自商用导致的一切后果,由使用者承担责任。
2024-09-22 10:57:08
33
本站
JQuery插件下载
...的核心功能在于其评分机制,它允许用户通过点击或触摸屏幕来对内容进行打分,评分结果可以精确到小数位,从而更准确地反映用户的满意度或评价。这种高精度的评分方式使得用户反馈更加细腻,有助于提高数据的准确性。jsRapStar不仅在功能上表现出色,在外观设计上也极具灵活性。它支持用户根据自身需求调整评分星星的样式、颜色以及大小等,使得评分组件能够与网站的整体风格完美融合。此外,该插件还提供了丰富的配置选项,包括但不限于:是否显示评分数值、评分范围、点击事件处理等,让开发者可以根据具体项目要求进行个性化设置。值得一提的是,jsRapStar的使用十分简便,只需引入相关文件并在HTML中添加相应的标签即可快速集成至任何网页中。同时,其轻量级的设计确保了加载速度不会受到影响,即使在移动设备上也能保持良好的性能表现。总之,无论是用于电子商务平台的商品评价系统,还是社交媒体上的内容打分功能,jsRapStar都能提供一套高效、美观且易于定制的解决方案,帮助提升用户体验并增加互动性。 点我下载 文件大小:43.20 KB 您将下载一个JQuery插件资源包,该资源包内部文件的目录结构如下: 本网站提供JQuery插件下载功能,旨在帮助广大用户在工作学习中提升效率、节约时间。 本网站的下载内容来自于互联网。如您发现任何侵犯您权益的内容,请立即告知我们,我们将迅速响应并删除相关内容。 免责声明:站内所有资源仅供个人学习研究及参考之用,严禁将这些资源应用于商业场景。 若擅自商用导致的一切后果,由使用者承担责任。
2024-11-13 21:13:02
69
本站
JQuery
...飞速发展,开发者们在处理按钮交互时有了更多选择和策略。例如,在React、Vue等主流前端框架中,通过状态管理实现按钮的禁用逻辑更为常见,不仅能实时响应数据变化,还能避免因异步操作带来的并发问题。 近期,Web Components标准逐渐成熟,原生HTML元素如 也拥有了更强大的功能扩展能力。开发者可以直接在自定义元素中利用disabled属性或新增属性进行更为精细的按钮交互控制,并结合Shadow DOM实现封装性更好的组件设计。 此外,对于表单提交场景,除了禁用按钮防止重复提交外,还可以采用防抖(debounce)或节流(throttle)技术优化用户点击事件的触发频率,从而提高页面性能和用户体验。同时,遵循WCAG(Web Content Accessibility Guidelines)无障碍网页规范,确保在禁用按钮的同时,为视障用户提供清晰的可访问性提示,也是当前前端开发不可忽视的重要环节。 综上所述,尽管jQuery在按钮禁用功能上提供了简洁易用的API,但在日益复杂的前端应用场景下,结合最新技术和最佳实践来优化按钮交互逻辑,已成为提升网站品质与用户体验的关键所在。
2023-06-09 14:51:42
158
键盘勇士
VUE
...s后,我们发现Vue框架的响应式机制在CSS类管理上的强大之处。为了进一步掌握这一技术,可关注Vue.js官方文档的最新更新和最佳实践,了解Vue3.0版本中对v-bind:class指令的优化改进。 近期一篇来自Vue.js官方博客的文章“Vue 3中的新特性:Conditional Classes with v-bind:class”详细解读了如何利用新的语法糖更好地实现条件class绑定,并通过实例代码展示了与旧版Vue的差异和优势。此外,文章还探讨了v-bind:class结合模板refs、计算属性以及组合式API(Composition API)等Vue高级特性的应用场景,帮助开发者提升组件化开发效率。 另外,InfoQ的一篇报道《Vue.js在大型项目中的CSS类管理策略》也值得一看,文中不仅回顾了v-bind:class的基本用法,还分享了一些实际项目中如何结合模块化、CSS预处理器等工具进行复杂场景下的class动态管理,这对于面临大规模应用架构挑战的前端开发者具有很高的参考价值。 最后,Vue社区的一些教程如"Vue Conditional Classes: The Complete Guide",提供了大量实战案例,引导读者逐步掌握条件class的各种绑定技巧,包括但不限于基于状态切换、事件驱动、以及与其他Vue指令如v-if、v-for等协同工作的方法,为读者深化Vue技能树提供有力支撑。
2023-07-15 17:19:02
197
键盘勇士
VUE
...e.js团队持续优化框架性能与开发者体验,在Vue 3.x版本中对生命周期钩子进行了重构和扩展,新增了诸如onBeforeUnmount等API,以更好地满足现代前端开发需求。同时,官方文档也强烈建议开发者关注并合理使用这些生命周期钩子,特别是在处理如定时器、事件监听器等可能会导致内存泄漏的情况时。 例如,除了beforeDestroy或beforeUnmount外,Vue 3引入了setup()函数,它在组件实例创建之后、渲染之前执行,为资源初始化提供了更为灵活的时机。而在卸载阶段,可以结合onUnmounted()来替代旧版的beforeDestroy钩子,实现更加清晰且易于维护的清理逻辑。 此外,对于大型项目或长期运行的应用,有效管理内存至关重要。开发者应深入理解JavaScript垃圾回收机制,并结合Vue.js特性,确保在组件销毁时解除所有引用,防止无用数据长时间占据内存空间。因此,掌握如何利用Vue.js生命周期钩子进行资源释放,不仅是提升应用性能的关键步骤,也是提高代码质量、避免潜在问题的良好实践。 同时,社区中也有许多针对Vue.js内存管理及性能优化的实战案例和深度解析文章,通过学习这些前沿实践,开发者能够更全面地理解和运用Vue.js生命周期钩子,从而编写出更加高效、健壮的组件代码。
2023-12-03 18:12:48
66
逻辑鬼才
JQuery
...前端开发领域中CSS处理技术的发展趋势和最佳实践。 近期,随着Web Components和框架(如React、Vue)的普及,原生CSS API与JavaScript的结合愈发紧密。例如,在React中,通过styled-components或CSS Modules可以将CSS样式直接内联到JSX组件中,实现更精细化的样式控制和更好的可维护性。同时,CSS-in-JS方案使得动态修改样式更为方便,它采用JavaScript编程的方式来编写CSS,并能充分利用变量、函数等特性,大大提升了样式管理的灵活性。 另外,随着浏览器原生API的不断进化,诸如CSS Variables(CSS自定义属性)、MutationObserver(用于监听DOM变化)、以及Houdini项目(旨在为开发者提供更低级别的CSS控制)等新兴技术,也为动态样式处理提供了更多可能。这些技术不仅增强了CSS样式的交互性和响应能力,也使jQuery等库在某些场景下的功能被逐步替代或者优化。 总的来说,虽然jQuery的.css()方法在当前依然广泛应用于各类项目中,但随着Web技术的快速发展,理解并掌握新型CSS处理技术和理念对于提升前端开发效率与代码质量具有重要意义。因此,建议读者继续关注CSS领域的新标准、新工具及框架的最佳实践,以便在实际项目中更好地运用和发挥。
2023-10-26 21:49:22
350
电脑达人
JQuery
...了HTML文档遍历、事件处理、动画和Ajax交互等功能,提供了一套简洁易用的API,使得开发者能够更高效地进行JavaScript编程。 CSS选择器 , CSS选择器是一种用于在HTML文档中定位元素的方法,通过描述元素的属性、层级关系等特征来选取需要操作的DOM元素。在本文中,jQuery使用了CSS选择器语法来查找ID以“i”开头的div元素,例如$(div id^= i ),其中 id^= i 就是一个CSS选择器,表示匹配所有id属性值以字符串“i”开头的元素。 DOM操作 , DOM(Document Object Model)操作是指在网页加载后,通过JavaScript动态修改或访问HTML文档结构与内容的过程。在jQuery库中,提供了丰富且易于使用的DOM操作方法,如查找元素、改变内容、添加或删除节点等,从而极大地提升了前端开发者对页面元素进行动态控制的能力。在文章示例中,通过jQuery的选择器功能实现对ID以特定字符开头的元素进行筛选和操作,就是DOM操作的一种具体应用。
2023-06-13 17:39:52
322
软件工程师
JQuery
...了HTML文档遍历、事件处理、动画以及Ajax交互等功能。在本文的上下文中,jQuery通过提供简洁易用的API帮助开发者更高效地操作DOM元素,例如选择、修改a标签的href属性等。 href属性 , 在HTML中,href是超链接(a标签)的一个关键属性,全称为Hyperlink Reference,用于指定链接的目标URL。当用户点击该链接时,浏览器会跳转到href属性所设置的网页地址。文章中详细介绍了如何使用jQuery获取和更改a标签的href属性值。 attr()方法 , 在jQuery框架中,attr()是一个非常重要的方法,用于获取或设置HTML元素的属性值。根据文章内容,attr()方法可以用来读取或修改a标签的href属性。例如$( link ).attr( href )可以获取id为\ link\ 的a标签当前的href地址,而$( link ).attr( href , http://www.newlink.com )则将这个a标签的href地址改为新的网址。 each()函数 , jQuery中的each()函数是一种迭代器方法,它可以对jQuery对象集合中的每一个元素执行一个函数。在本文中,each()函数被用来遍历所有具有相同类名(如\ .link\ )的a标签,并对每个元素分别执行代码块内的操作,如修改其href属性值。在循环体内,$(element)代表当前迭代到的元素,这样就可以针对集合中的每个元素进行单独处理。
2023-11-18 19:01:21
335
数据库专家
JQuery
...了HTML文档遍历、事件处理、动画和Ajax交互等复杂操作,极大地提高了开发者的工作效率。在本文中,jQuery用于绑定按钮点击事件、获取和设置元素的位置坐标。 offset()方法 , 在jQuery框架中,offset()方法用于获取或设置元素相对于文档(而非视口)的偏移坐标,返回一个包含top和left属性的对象,分别表示元素距离文档顶部和左边的距离。在本文的具体应用中,通过不断更新按钮元素的offset值,实现了按钮螺旋前进的动画效果。 正弦函数(Math.sin()) , 正弦函数是数学中的基本三角函数之一,在JavaScript的Math对象中以Math.sin()的形式提供。它接收一个以弧度为单位的角度作为参数,并返回该角度对应的正弦值。在本文实现螺旋运动的过程中,利用正弦函数根据横坐标生成纵坐标的动态变化,模拟出一种类似螺旋上升或下降的路径效果。
2023-10-07 14:59:45
631
数据库专家
站内搜索
用于搜索本网站内部文章,支持栏目切换。
知识学习
实践的时候请根据实际情况谨慎操作。
随机学习一条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
历史内容
快速导航到对应月份的历史文章列表。
随便看看
拉到页底了吧,随便看看还有哪些文章你可能感兴趣。
时光飞逝
"流光容易把人抛,红了樱桃,绿了芭蕉。"