﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-java学习</title><link>http://www.blogjava.net/yangjunwei/</link><description>java学习</description><language>zh-cn</language><lastBuildDate>Tue, 28 Apr 2026 23:19:43 GMT</lastBuildDate><pubDate>Tue, 28 Apr 2026 23:19:43 GMT</pubDate><ttl>60</ttl><item><title>docker 笔记</title><link>http://www.blogjava.net/yangjunwei/archive/2021/09/22/435978.html</link><dc:creator>杨军威</dc:creator><author>杨军威</author><pubDate>Wed, 22 Sep 2021 09:02:00 GMT</pubDate><guid>http://www.blogjava.net/yangjunwei/archive/2021/09/22/435978.html</guid><wfw:comment>http://www.blogjava.net/yangjunwei/comments/435978.html</wfw:comment><comments>http://www.blogjava.net/yangjunwei/archive/2021/09/22/435978.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yangjunwei/comments/commentRss/435978.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yangjunwei/services/trackbacks/435978.html</trackback:ping><description><![CDATA[<div>下载的docker镜像默认存储路径是/var/lib/docker .具体的镜像文件就在containers文件夹中</div><div></div><div>docker save -o d:/docker/zen.tar easysoft/zentao:15.5</div><div></div><div></div><div></div><div>docker run -d -p 80:80&nbsp; \</div><div>&nbsp; &nbsp; &nbsp; &nbsp; -e ADMINER_USER="admin" -e ADMINER_PASSWD="qqzj126" -e MYSQL_ROOT_PASSWORD=qqzj126&nbsp; \</div><div>&nbsp; &nbsp; &nbsp; &nbsp; -e BIND_ADDRESS="false" \</div><div>&nbsp; &nbsp; &nbsp; &nbsp; -v /opt/data/zbox/:/opt/zbox/ \</div><div>&nbsp; &nbsp; &nbsp; &nbsp; -v /opt/mysqldata:/var/lib/mysql&nbsp; \</div><div>&nbsp; &nbsp; &nbsp; &nbsp; --name zentao-server \</div><div>&nbsp; &nbsp; &nbsp; &nbsp; easysoft/zentao:15.5</div><div></div><div></div><div></div><div>&nbsp; docker logs -f&nbsp;</div><img src ="http://www.blogjava.net/yangjunwei/aggbug/435978.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yangjunwei/" target="_blank">杨军威</a> 2021-09-22 17:02 <a href="http://www.blogjava.net/yangjunwei/archive/2021/09/22/435978.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>后台运行jar包并输出日志</title><link>http://www.blogjava.net/yangjunwei/archive/2021/06/01/435884.html</link><dc:creator>杨军威</dc:creator><author>杨军威</author><pubDate>Tue, 01 Jun 2021 05:56:00 GMT</pubDate><guid>http://www.blogjava.net/yangjunwei/archive/2021/06/01/435884.html</guid><wfw:comment>http://www.blogjava.net/yangjunwei/comments/435884.html</wfw:comment><comments>http://www.blogjava.net/yangjunwei/archive/2021/06/01/435884.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yangjunwei/comments/commentRss/435884.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yangjunwei/services/trackbacks/435884.html</trackback:ping><description><![CDATA[<p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">运行命令（注意路径）</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">java -jar /web/share-book.jar &gt; /web/log.txt &amp;<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />该命令的意思是：执行share-book.jar这个文件，并且输出到log.txt文件，&amp;表示后台运行</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">解决更新项目带来的频繁重启操作，创建2个脚本</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;"><span style="box-sizing: border-box; outline: 0px; font-weight: 700; overflow-wrap: break-word;">start.sh</span></p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">#! /bin/bash<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />#注意：必须有&amp;让其后台执行，否则没有pid生成 &nbsp;&nbsp;jar包路径为绝对路径<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />java -jar /web/share-book.jar &gt; /web/log.txt &amp;<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />&nbsp;<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" /># 将jar包启动对应的pid写入文件中，为停止时提供pid<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />echo $! &gt; /web/pid.txt<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" /><span style="box-sizing: border-box; outline: 0px; font-weight: 700; overflow-wrap: break-word;">stop.sh</span></p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;"><span style="box-sizing: border-box; outline: 0px; font-weight: 700; overflow-wrap: break-word;">#! /bin/bash<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />PID=$(cat /web/pid.txt)<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />kill -9 $PID</span></p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">启动项目：./start.sh</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">停止项目：./stop.sh</p><img src ="http://www.blogjava.net/yangjunwei/aggbug/435884.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yangjunwei/" target="_blank">杨军威</a> 2021-06-01 13:56 <a href="http://www.blogjava.net/yangjunwei/archive/2021/06/01/435884.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HADOOP_HOME and hadoop.home.dir are unset</title><link>http://www.blogjava.net/yangjunwei/archive/2021/04/19/435856.html</link><dc:creator>杨军威</dc:creator><author>杨军威</author><pubDate>Mon, 19 Apr 2021 01:45:00 GMT</pubDate><guid>http://www.blogjava.net/yangjunwei/archive/2021/04/19/435856.html</guid><wfw:comment>http://www.blogjava.net/yangjunwei/comments/435856.html</wfw:comment><comments>http://www.blogjava.net/yangjunwei/archive/2021/04/19/435856.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yangjunwei/comments/commentRss/435856.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yangjunwei/services/trackbacks/435856.html</trackback:ping><description><![CDATA[<span style="color: #404040; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">一.问题描述：windows本地调试Hadoop程序时报错</span><br style="box-sizing: border-box; color: #404040; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;" /><span style="color: #404040; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">错误信息：<br /></span><div><div>其原因是需要在windows本地搭建Hadoop环境，下载winutils文件，并将hadoop-2.8.4包内的bin文件替换，将下载文件中hadoop.dll放到C：\Windows\System32下<br /> 二.解决过程如下：<br /> 1.下载hadoop，去官网下载对应的hadoop版本，我在linux集群搭建的是hadoop-2.8.4，因此将hadoop-2.8.4下载到windows本地</div><div>https://www.jianshu.com/p/a65a95108620</div></div><img src ="http://www.blogjava.net/yangjunwei/aggbug/435856.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yangjunwei/" target="_blank">杨军威</a> 2021-04-19 09:45 <a href="http://www.blogjava.net/yangjunwei/archive/2021/04/19/435856.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>从git仓库中删除.idea文件夹</title><link>http://www.blogjava.net/yangjunwei/archive/2021/01/14/435773.html</link><dc:creator>杨军威</dc:creator><author>杨军威</author><pubDate>Thu, 14 Jan 2021 07:15:00 GMT</pubDate><guid>http://www.blogjava.net/yangjunwei/archive/2021/01/14/435773.html</guid><wfw:comment>http://www.blogjava.net/yangjunwei/comments/435773.html</wfw:comment><comments>http://www.blogjava.net/yangjunwei/archive/2021/01/14/435773.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yangjunwei/comments/commentRss/435773.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yangjunwei/services/trackbacks/435773.html</trackback:ping><description><![CDATA[<p style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 0px 0px 16px; font-size: 18px; color: #4d4d4d; line-height: 26px; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: common-ligatures; background-color: #f5f6f7;">如果不配置.gitignore的文件，带push代码的时候就会把一写不必要的文件push到远程仓库，如.idea文件。如果不小心出现此文件在远程仓库可以通过一下步骤delete此文件：</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 0px 0px 16px; font-size: 18px; color: #4d4d4d; line-height: 26px; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: common-ligatures; background-color: #f5f6f7;">1.配置.gitignore文件(新建/编辑）</p><pre style="box-sizing: border-box; outline: 0px; padding: 8px 16px 6px 56px; margin-top: 0px; margin-bottom: 24px; position: relative; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; overflow: auto hidden; border: none; line-height: 22px; background-color: #282c34; font-variant-ligatures: common-ligatures;"><code hljs=""  bash"="" style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; display: block; overflow-x: auto; padding: 8px; color: #abb2bf; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; line-height: 22px; border-radius: 4px; overflow-wrap: normal; min-width: 94%; text-size-adjust: none; word-break: break-all; position: unset;"><span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;">echo</span> <span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;">'.idea'</span> &gt;&gt; .gitignore</code></pre><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 0px 0px 16px; font-size: 18px; color: #4d4d4d; line-height: 26px; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: common-ligatures; background-color: #f5f6f7;">2.将.gitignore文件上传到远程仓库</p><pre style="box-sizing: border-box; outline: 0px; padding: 8px 16px 6px 56px; margin-top: 0px; margin-bottom: 24px; position: relative; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; overflow: auto hidden; border: none; line-height: 22px; background-color: #282c34; font-variant-ligatures: common-ligatures;"><code hljs=""  sql"="" style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; display: block; overflow-x: auto; padding: 8px; color: #abb2bf; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; line-height: 22px; border-radius: 4px; overflow-wrap: normal; min-width: 94%; text-size-adjust: none; word-break: break-all; position: unset;">git pull git add .gitignore git <span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;">commit</span> -m <span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;">'edit .gitignore'</span> git push origin master</span></code></pre><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 0px 0px 16px; font-size: 18px; color: #4d4d4d; line-height: 26px; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: common-ligatures; background-color: #f5f6f7;">3.删除git的.idea文件</p><pre style="box-sizing: border-box; outline: 0px; padding: 8px 16px 6px 56px; margin-top: 0px; margin-bottom: 24px; position: relative; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; overflow: auto hidden; border: none; line-height: 22px; background-color: #282c34; font-variant-ligatures: common-ligatures;"><code hljs=""  brainfuck"="" style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; display: block; overflow-x: auto; padding: 8px; color: #abb2bf; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; line-height: 22px; border-radius: 4px; overflow-wrap: normal; min-width: 94%; text-size-adjust: none; word-break: break-all; position: unset;"><span style="box-sizing: border-box; outline: 0px; font-style: italic; font-size: inherit; overflow-wrap: normal; word-break: break-all;">git</span> <span style="box-sizing: border-box; outline: 0px; font-style: italic; font-size: inherit; overflow-wrap: normal; word-break: break-all;">rm</span> <span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;">-</span><span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;">-</span><span style="box-sizing: border-box; outline: 0px; font-style: italic; font-size: inherit; overflow-wrap: normal; word-break: break-all;">cached</span> <span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;">-</span><span style="box-sizing: border-box; outline: 0px; font-style: italic; font-size: inherit; overflow-wrap: normal; word-break: break-all;">r</span> <span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;">.</span><span style="box-sizing: border-box; outline: 0px; font-style: italic; font-size: inherit; overflow-wrap: normal; word-break: break-all;">idea</span></code></pre><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 0px 0px 16px; font-size: 18px; color: #4d4d4d; line-height: 26px; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: common-ligatures; background-color: #f5f6f7;">4.同步到远程仓库</p><pre style="box-sizing: border-box; outline: 0px; padding: 8px 16px 6px 56px; margin-top: 0px; margin-bottom: 24px; position: relative; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; overflow: auto hidden; border: none; line-height: 22px; background-color: #282c34; font-variant-ligatures: common-ligatures;"><code hljs=""  sql"="" style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; display: block; overflow-x: auto; padding: 8px; color: #abb2bf; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; line-height: 22px; border-radius: 4px; overflow-wrap: normal; min-width: 94%; text-size-adjust: none; word-break: break-all; position: unset;">git <span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;">commit</span> -m <span style="box-sizing: border-box; outline: 0px; font-size: inherit; overflow-wrap: normal; word-break: break-all;">'delete .idea'</span> git push origin master</span></code></pre><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 0px 0px 16px; font-size: 18px; color: #4d4d4d; line-height: 26px; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: common-ligatures; background-color: #f5f6f7;">完成之后就可以发现git仓库中的.idea文件已经被删除，而且之后push代码也不会再把.idea文件上传。</p><p style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 0px 0px 16px; font-size: 18px; color: #4d4d4d; line-height: 26px; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: common-ligatures; background-color: #f5f6f7;">PS：我在使用PyCharm编写python代码，一般是通过<code style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 14px; line-height: 22px; color: #c7254e; background-color: #f9f2f4; border-radius: 2px; padding: 2px 4px;">new -&gt; .ignore file -&gt; .gitignore file</code>&nbsp;自动生成.gitignore文件。<br style="box-sizing: border-box; outline: 0px;" />下面是我自己比较常用的.gitignore文件简短配置：</p><pre style="box-sizing: border-box; outline: 0px; padding: 8px 16px 6px 56px; margin-top: 0px; margin-bottom: 24px; position: relative; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; overflow: auto hidden; border: none; line-height: 22px; background-color: #282c34; font-variant-ligatures: common-ligatures;"><code hljs=""  "="" style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; display: block; overflow-x: auto; padding: 8px; color: #abb2bf; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; line-height: 22px; border-radius: 4px; overflow-wrap: normal; min-width: 94%; text-size-adjust: none; word-break: break-all; position: unset;">.project .settings/ .prefs .pydevproject .idea/ .idea .DS_Store .cache *.pyc *.html *.xlm</code></pre><img src ="http://www.blogjava.net/yangjunwei/aggbug/435773.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yangjunwei/" target="_blank">杨军威</a> 2021-01-14 15:15 <a href="http://www.blogjava.net/yangjunwei/archive/2021/01/14/435773.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>GC overhead limit exceeded和java heap space</title><link>http://www.blogjava.net/yangjunwei/archive/2020/12/01/435736.html</link><dc:creator>杨军威</dc:creator><author>杨军威</author><pubDate>Tue, 01 Dec 2020 02:19:00 GMT</pubDate><guid>http://www.blogjava.net/yangjunwei/archive/2020/12/01/435736.html</guid><wfw:comment>http://www.blogjava.net/yangjunwei/comments/435736.html</wfw:comment><comments>http://www.blogjava.net/yangjunwei/archive/2020/12/01/435736.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yangjunwei/comments/commentRss/435736.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yangjunwei/services/trackbacks/435736.html</trackback:ping><description><![CDATA[1、java heap space&nbsp; 一次申请太大的内存空间<br />2、GC overhead limit exceeded&nbsp; &nbsp;创建太多的对象，gc收集不完<img src ="http://www.blogjava.net/yangjunwei/aggbug/435736.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yangjunwei/" target="_blank">杨军威</a> 2020-12-01 10:19 <a href="http://www.blogjava.net/yangjunwei/archive/2020/12/01/435736.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>缓存一致性和缓存雪崩</title><link>http://www.blogjava.net/yangjunwei/archive/2020/11/19/435728.html</link><dc:creator>杨军威</dc:creator><author>杨军威</author><pubDate>Thu, 19 Nov 2020 06:12:00 GMT</pubDate><guid>http://www.blogjava.net/yangjunwei/archive/2020/11/19/435728.html</guid><wfw:comment>http://www.blogjava.net/yangjunwei/comments/435728.html</wfw:comment><comments>http://www.blogjava.net/yangjunwei/archive/2020/11/19/435728.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yangjunwei/comments/commentRss/435728.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yangjunwei/services/trackbacks/435728.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/yangjunwei/archive/2020/11/19/435728.html'>阅读全文</a><img src ="http://www.blogjava.net/yangjunwei/aggbug/435728.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yangjunwei/" target="_blank">杨军威</a> 2020-11-19 14:12 <a href="http://www.blogjava.net/yangjunwei/archive/2020/11/19/435728.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux Tomcat 开机启动配置</title><link>http://www.blogjava.net/yangjunwei/archive/2020/11/17/435726.html</link><dc:creator>杨军威</dc:creator><author>杨军威</author><pubDate>Tue, 17 Nov 2020 02:40:00 GMT</pubDate><guid>http://www.blogjava.net/yangjunwei/archive/2020/11/17/435726.html</guid><wfw:comment>http://www.blogjava.net/yangjunwei/comments/435726.html</wfw:comment><comments>http://www.blogjava.net/yangjunwei/archive/2020/11/17/435726.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yangjunwei/comments/commentRss/435726.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yangjunwei/services/trackbacks/435726.html</trackback:ping><description><![CDATA[<div>1、 vim /etc/rc.d/rc.local</div><div>2、添加内容</div><div>export JAVA_HOME=/usr/java/jdk1.8.0_111</div><div>/app/tomcat/bin/startup.sh start</div><div>3、</div><div>chmod 777 /etc/rc.d/rc.local</div><img src ="http://www.blogjava.net/yangjunwei/aggbug/435726.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yangjunwei/" target="_blank">杨军威</a> 2020-11-17 10:40 <a href="http://www.blogjava.net/yangjunwei/archive/2020/11/17/435726.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java synchronized 锁对象</title><link>http://www.blogjava.net/yangjunwei/archive/2020/10/30/435713.html</link><dc:creator>杨军威</dc:creator><author>杨军威</author><pubDate>Fri, 30 Oct 2020 08:37:00 GMT</pubDate><guid>http://www.blogjava.net/yangjunwei/archive/2020/10/30/435713.html</guid><wfw:comment>http://www.blogjava.net/yangjunwei/comments/435713.html</wfw:comment><comments>http://www.blogjava.net/yangjunwei/archive/2020/10/30/435713.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yangjunwei/comments/commentRss/435713.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yangjunwei/services/trackbacks/435713.html</trackback:ping><description><![CDATA[<div>/**</div><div><span style="white-space:pre">	</span> * synchronized 放在普通方法上，内置锁就是当前类的实例</div><div><span style="white-space:pre">	</span> * @return</div><div><span style="white-space:pre">	</span> */</div><div><span style="white-space:pre">	</span>public synchronized int getNext() {</div><div><span style="white-space:pre">		</span>return value ++;</div><div><span style="white-space:pre">	</span>}</div><div><span style="white-space:pre">	</span></div><div><span style="white-space:pre">	</span>/**</div><div><span style="white-space:pre">	</span> * 修饰静态方法，内置锁是当前的Class字节码对象</div><div><span style="white-space:pre">	</span> * Sequence.class</div><div><span style="white-space:pre">	</span> * @return</div><div><span style="white-space:pre">	</span> */</div><div><span style="white-space:pre">	</span>public static synchronized int getPrevious() {</div><div>//<span style="white-space:pre">		</span>return value --;</div><div><span style="white-space:pre">		</span>return 0;</div><div><span style="white-space:pre">	</span>}</div><img src ="http://www.blogjava.net/yangjunwei/aggbug/435713.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yangjunwei/" target="_blank">杨军威</a> 2020-10-30 16:37 <a href="http://www.blogjava.net/yangjunwei/archive/2020/10/30/435713.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>canal简单安装使用</title><link>http://www.blogjava.net/yangjunwei/archive/2020/08/31/435649.html</link><dc:creator>杨军威</dc:creator><author>杨军威</author><pubDate>Mon, 31 Aug 2020 02:55:00 GMT</pubDate><guid>http://www.blogjava.net/yangjunwei/archive/2020/08/31/435649.html</guid><wfw:comment>http://www.blogjava.net/yangjunwei/comments/435649.html</wfw:comment><comments>http://www.blogjava.net/yangjunwei/archive/2020/08/31/435649.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yangjunwei/comments/commentRss/435649.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yangjunwei/services/trackbacks/435649.html</trackback:ping><description><![CDATA[<p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;"><span style="margin: 0px 3px; padding: 0px;"><span style="margin: 0px; padding: 0px; font-size: 18px;">1、数据库配置</span></span></p><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">首先使用canal需要修改数据库配置</p><div style="margin: 5px 0px; padding-right: 1em; padding-left: 1em; background-color: #f2f4f5; border-width: initial !important; border-style: none !important; border-color: initial !important; font-family: &quot;Lucida Console&quot;, Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace !important; font-size: 12px !important; border-radius: 3px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; color: #656c73; font-family: inherit !important;"><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">[mysqld] <br />log-bin=mysql-bin # 开启<br /> binlog binlog-format=ROW # 选择 ROW 模式 <br />server_id=1 # 配置 MySQL replaction 需要定义，不要和 canal 的 slaveId 重复</span></pre></div><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">创建canal数据库用户</p><div style="margin: 5px 0px; padding-right: 1em; padding-left: 1em; background-color: #f2f4f5; border-width: initial !important; border-style: none !important; border-color: initial !important; font-family: &quot;Lucida Console&quot;, Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace !important; font-size: 12px !important; border-radius: 3px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; color: #656c73; font-family: inherit !important;">CREATE USER canal IDENTIFIED BY <span style="margin: 0px; padding: 0px; color: #800000; font-family: inherit !important; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #800000; font-family: inherit !important; line-height: 1.5 !important;">canal</span><span style="margin: 0px; padding: 0px; color: #800000; font-family: inherit !important; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">;  <br /> GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON </span>*.* TO <span style="margin: 0px; padding: 0px; color: #800000; font-family: inherit !important; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #800000; font-family: inherit !important; line-height: 1.5 !important;">canal</span><span style="margin: 0px; padding: 0px; color: #800000; font-family: inherit !important; line-height: 1.5 !important;">'</span>@<span style="margin: 0px; padding: 0px; color: #800000; font-family: inherit !important; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #800000; font-family: inherit !important; line-height: 1.5 !important;">%</span><span style="margin: 0px; padding: 0px; color: #800000; font-family: inherit !important; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">;<br /> FLUSH PRIVILEGES;</span></pre></div><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;"><span style="margin: 0px 3px; padding: 0px;"><span style="margin: 0px; padding: 0px; font-size: 18px;">2、安装canal</span></span></p><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">下载：<a href="https://github.com/alibaba/canal/releases" style="margin: 0px; padding: 0px; color: #2d8cf0; text-decoration-line: none; transition: all 0.3s ease 0s;">https://github.com/alibaba/canal/releases</a></p><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">解压（修改版本号）：tar zxvf canal.deployer-1.1.4.tar.gz -C ./canal</p><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">配置开放服务器端口：11110、11111、11112</p><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">修改canal配置文件（这里设置了两个instance，即两个数据库）：</p><div style="margin: 5px 0px; padding-right: 1em; padding-left: 1em; background-color: #f2f4f5; border-width: initial !important; border-style: none !important; border-color: initial !important; font-family: &quot;Lucida Console&quot;, Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace !important; font-size: 12px !important; border-radius: 3px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; color: #656c73; font-family: inherit !important;"><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">vi</span> canal/conf/<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">canal.properties <br />canal.destinations </span>= example1,example2</pre></div><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">&nbsp;配置instance：</p><div style="margin: 5px 0px; padding-right: 1em; padding-left: 1em; background-color: #f2f4f5; border-width: initial !important; border-style: none !important; border-color: initial !important; font-family: &quot;Lucida Console&quot;, Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace !important; font-size: 12px !important; border-radius: 3px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; color: #656c73; font-family: inherit !important;"><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">cp</span> -R canal/conf/example conf/<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">example1<br /> </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">mv</span> conf/example conf/example2</pre></div><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">第一个数据库配置</p><div style="margin: 5px 0px; padding-right: 1em; padding-left: 1em; background-color: #f2f4f5; border-width: initial !important; border-style: none !important; border-color: initial !important; font-family: &quot;Lucida Console&quot;, Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace !important; font-size: 12px !important; border-radius: 3px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; color: #656c73; font-family: inherit !important;"><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">vi</span> canal/conf/example1/<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">instance.properties<br /> canal.instance.master.address</span>=<span style="margin: 0px; padding: 0px; color: #800080; font-family: inherit !important; line-height: 1.5 !important;">32.1</span>.<span style="margin: 0px; padding: 0px; color: #800080; font-family: inherit !important; line-height: 1.5 !important;">2.140</span>:<span style="margin: 0px; padding: 0px; color: #800080; font-family: inherit !important; line-height: 1.5 !important;">3306</span></pre></div><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">第二个数据库配置</p><div style="margin: 5px 0px; padding-right: 1em; padding-left: 1em; background-color: #f2f4f5; border-width: initial !important; border-style: none !important; border-color: initial !important; font-family: &quot;Lucida Console&quot;, Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace !important; font-size: 12px !important; border-radius: 3px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; color: #656c73; font-family: inherit !important;"><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">vi</span> canal/conf/example2/<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">instance.properties<br /> canal.instance.master.address</span>=<span style="margin: 0px; padding: 0px; color: #800080; font-family: inherit !important; line-height: 1.5 !important;">32.1</span>.<span style="margin: 0px; padding: 0px; color: #800080; font-family: inherit !important; line-height: 1.5 !important;">2.140</span>:<span style="margin: 0px; padding: 0px; color: #800080; font-family: inherit !important; line-height: 1.5 !important;">3307</span></pre></div><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">#如果需要新增一个instance，只需要修改canal.properties文件，并新增一个instance配置即可，无需重启canal。</p><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">运行：</p><div style="margin: 5px 0px; padding-right: 1em; padding-left: 1em; background-color: #f2f4f5; border-width: initial !important; border-style: none !important; border-color: initial !important; font-family: &quot;Lucida Console&quot;, Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace !important; font-size: 12px !important; border-radius: 3px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; color: #656c73; font-family: inherit !important;"><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">sh</span> canal/bin/startup.<span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">sh</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> # 查看日志<br /> </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">cat</span> canal/logs/canal/canal</pre></div><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;"><span style="margin: 0px 3px; padding: 0px;"><span style="margin: 0px; padding: 0px; font-size: 18px;">3、Java使用样例</span></span></p><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">引入pom依赖，需要与安装的canal版本一致</p><div style="margin: 5px 0px; padding-right: 1em; padding-left: 1em; background-color: #f2f4f5; border-width: initial !important; border-style: none !important; border-color: initial !important; font-family: &quot;Lucida Console&quot;, Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace !important; font-size: 12px !important; border-radius: 3px !important;"><div style="margin: 5px 0px 0px; background-color: transparent; color: #656c73; width: 20px;"><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #2d8cf0; transition: all 0.3s ease 0s; background-color: #f5f5f5 !important; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 15px 0px 30px; padding: 0px; border: none !important; background-color: transparent !important; height: auto; max-width: 960px !important; display: block; border-radius: 3px; box-shadow: rgba(27, 31, 35, 0.15) 0px 1px 15px, rgba(106, 115, 125, 0.35) 0px 0px 1px;" /></a></span></div><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; color: #656c73; font-family: inherit !important;">&lt;dependencies&gt;     &lt;dependency&gt;         &lt;groupId&gt;com.alibaba.otter&lt;/groupId&gt;         &lt;artifactId&gt;canal.client&lt;/artifactId&gt;         &lt;version&gt;<span style="margin: 0px; padding: 0px; color: #800080; font-family: inherit !important; line-height: 1.5 !important;">1.1</span>.<span style="margin: 0px; padding: 0px; color: #800080; font-family: inherit !important; line-height: 1.5 !important;">4</span>&lt;/version&gt;     &lt;/dependency&gt; &lt;/dependencies&gt;</pre><div style="margin: 5px 0px 0px; background-color: transparent; color: #656c73; width: 20px;"><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #2d8cf0; transition: all 0.3s ease 0s; background-color: #f5f5f5 !important; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 15px 0px 30px; padding: 0px; border: none !important; background-color: transparent !important; height: auto; max-width: 960px !important; display: block; border-radius: 3px; box-shadow: rgba(27, 31, 35, 0.15) 0px 1px 15px, rgba(106, 115, 125, 0.35) 0px 0px 1px;" /></a></span></div></div><p style="margin-top: 13px; margin-bottom: 13px; padding: 0px; color: #314659; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">示例代码（异步打印两个数据库的修改内容）：</p><div style="margin: 5px 0px; padding-right: 1em; padding-left: 1em; background-color: #f2f4f5; border-width: initial !important; border-style: none !important; border-color: initial !important; font-family: &quot;Lucida Console&quot;, Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace !important; font-size: 12px !important; border-radius: 3px !important;"><div style="margin: 5px 0px 0px; background-color: transparent; color: #656c73; width: 20px;"><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #2d8cf0; transition: all 0.3s ease 0s; background-color: #f5f5f5 !important; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 15px 0px 30px; padding: 0px; border: none !important; background-color: transparent !important; height: auto; max-width: 960px !important; display: block; border-radius: 3px; box-shadow: rgba(27, 31, 35, 0.15) 0px 1px 15px, rgba(106, 115, 125, 0.35) 0px 0px 1px;" /></a></span></div><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; color: #656c73; font-family: inherit !important;"><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">package</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> cn.spicybar.dblog;  </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">import</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> com.alibaba.otter.canal.client.CanalConnector; </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">import</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> com.alibaba.otter.canal.client.CanalConnectors; </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">import</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> com.alibaba.otter.canal.protocol.CanalEntry.Entry; </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">import</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> com.alibaba.otter.canal.protocol.CanalEntry.EntryType; </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">import</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> com.alibaba.otter.canal.protocol.CanalEntry.RowChange; </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">import</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> com.alibaba.otter.canal.protocol.Message;  </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">import</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> java.net.InetSocketAddress; </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">import</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> java.util.List;  </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">public</span> <span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">class</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> CanalClient {      </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">public</span> <span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">static</span> <span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">void</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> main(String[] args) {         </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">new</span> Thread(() -&gt; initConnector("example1"<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">)).start();         </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">new</span> Thread(() -&gt; initConnector("example2"<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">)).start();     }      </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">private</span> <span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">static</span> <span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">void</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> initConnector(String destination) {         CanalConnector connector </span>= CanalConnectors.newSingleConnector(<span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">new</span> InetSocketAddress("32.1.0.237", 11111), destination, "", ""<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">);         </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">try</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> {             connector.connect();             connector.subscribe(</span>".*\\..*"<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">);             connector.rollback();             </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">while</span> (<span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">true</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">) {                 Message message </span>= connector.getWithoutAck(1000<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">);                 </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">if</span> (message.getId() != -1 &amp;&amp; message.getEntries().size() &gt; 0<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">) {                     printEntry(message.getEntries());                 }                 connector.ack(message.getId());             }         } </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">finally</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> {             connector.disconnect();         }     }      </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">private</span> <span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">static</span> <span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">void</span> printEntry(List&lt;Entry&gt;<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> entries) {         </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">for</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> (Entry entry : entries) {             </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">if</span> (entry.getEntryType() == EntryType.TRANSACTIONBEGIN || entry.getEntryType() ==<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> EntryType.TRANSACTIONEND) {                 </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">continue</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;">;             }             </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">try</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> {                 RowChange rowChange </span>=<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> RowChange.parseFrom(entry.getStoreValue());                 System.out.println(rowChange.getSql());             } </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">catch</span><span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> (Exception e) {                 </span><span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">throw</span> <span style="margin: 0px; padding: 0px; color: #0000ff; font-family: inherit !important; line-height: 1.5 !important;">new</span> RuntimeException("ERROR ## parser error, data:" +<span style="margin: 0px; padding: 0px; color: #000000; font-family: inherit !important; line-height: 1.5 !important;"> entry.toString(), e);             }         }     }</span></pre></div><img src ="http://www.blogjava.net/yangjunwei/aggbug/435649.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yangjunwei/" target="_blank">杨军威</a> 2020-08-31 10:55 <a href="http://www.blogjava.net/yangjunwei/archive/2020/08/31/435649.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java 二分法查询数据</title><link>http://www.blogjava.net/yangjunwei/archive/2020/08/07/435633.html</link><dc:creator>杨军威</dc:creator><author>杨军威</author><pubDate>Fri, 07 Aug 2020 03:00:00 GMT</pubDate><guid>http://www.blogjava.net/yangjunwei/archive/2020/08/07/435633.html</guid><wfw:comment>http://www.blogjava.net/yangjunwei/comments/435633.html</wfw:comment><comments>http://www.blogjava.net/yangjunwei/archive/2020/08/07/435633.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yangjunwei/comments/commentRss/435633.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yangjunwei/services/trackbacks/435633.html</trackback:ping><description><![CDATA[<pre style="background-color:#2b2b2b;color:#a9b7c6;font-family:'Consolas';font-size:9.8pt;"><span style="color:#cc7832;">public int </span><span style="color:#ffc66d;">binarySearch</span>(<span style="color:#cc7832;">long </span>value) {<br />   <span style="color:#cc7832;">int </span>middle = <span style="color:#6897bb;">0</span><span style="color:#cc7832;">;<br /></span><span style="color:#cc7832;">   int </span>low = <span style="color:#6897bb;">0</span><span style="color:#cc7832;">;<br /></span><span style="color:#cc7832;">   int </span>pow = <span style="color:#9876aa;">arr.length</span><span style="color:#cc7832;">;<br /></span><span style="color:#cc7832;">   <br /></span><span style="color:#cc7832;">   while</span>(<span style="color:#cc7832;">true</span>) {<br />      middle = (pow + low) / <span style="color:#6897bb;">2</span><span style="color:#cc7832;">;<br /></span><span style="color:#cc7832;">      if</span>(<span style="color:#9876aa;">arr</span>[middle] == value) {<br />         <span style="color:#cc7832;">return </span>middle<span style="color:#cc7832;">;<br /></span> } <span style="color:#cc7832;">else if</span>(low &gt; pow) {<br />         <span style="color:#cc7832;">return </span>-<span style="color:#6897bb;">1</span><span style="color:#cc7832;">;<br /></span> } <span style="color:#cc7832;">else </span>{<br />         <span style="color:#cc7832;">if</span>(<span style="color:#9876aa;">arr</span>[middle] &gt; value) {<br />            pow = middle - <span style="color:#6897bb;">1</span><span style="color:#cc7832;">;<br /></span> } <span style="color:#cc7832;">else </span>{<br />            low = middle + <span style="color:#6897bb;">1</span><span style="color:#cc7832;">;<br /></span> }<br />      }<br />   }<br />}</pre><img src ="http://www.blogjava.net/yangjunwei/aggbug/435633.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yangjunwei/" target="_blank">杨军威</a> 2020-08-07 11:00 <a href="http://www.blogjava.net/yangjunwei/archive/2020/08/07/435633.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>