CAS单点登录系列:

先放上官网文档地址:https://apereo.github.io/cas/5.1.x/index.html

然后说一下用到的东西:

jdk1.8、tomcat8.5、maven3.3、windows操作系统

1、下载Overlay

通过阅读官网文档(https://apereo.github.io/cas/5.1.x/planning/Getting-Started.html)了解到官方建议我们:

  1. It is recommended to build and deploy CAS locally using the WAR Overlay method.

通过使用一个名叫Overlay的项目来生成一个可以直接用的war包,来部署服务端,于是我们先下载这个项目,官网给出了两个构筑格式的:

我这里使用Maven的,下载地址:https://github.com/apereo/cas-overlay-template,或者使用我上传的网盘地址下载:

链接:https://pan.baidu.com/s/1c4wu6UVZIs1DTjbKRa17cw
提取码:fm2o

2、构筑Overlay

下载下来的Overlay默认配置就可以直接构筑能用的war包,直接使用它下边的build脚本执行

  1. build package

第一次构筑比较慢,可以在pom的repositories里加一个ali源,构筑会快一些。

构筑完后在target下找到一个war包,放到你的tomcat8.5(官方建议8.0以上版本,我建议使用8.5,如果你用8.0跑不起来,记得换成8.5以上版本)下跑起来试试吧:

http://localhost:8080/cas/login  默认账号:casuser  默认密码:Mellon  目前的配置仅有这一个用户

第一次会有两个红色警告,一个就是说你没用HTTPS登录,另一个就是你现在只有一个写死的用户,目前这个服务端只能看看,没什么实际用途。

别急,我们下边开始解决这两个问题。

这里先不要急着删掉你Tomcat下war包刚刚解压出来的内容

3、生成真正有用的服务端

这一节里面我们有两件事情要做:

第一个就是做一个keystore,Tomcat配置HTTPS访问的时候会用到;

第二个就是把我们的用户改成从数据库的表中读取的。

先说keystore:

使用jdk自带的keytool即可生成keystore,命令如下:

  1. keytool -genkey -alias cas -keyalg RSA -keysize -keypass -storepass -keystore D:/liuyx.keystore -dname "CN=cas.example.org,OU=liuyx.com,O=liuyx,L=JiNan,ST=JiNan,C=CN"

别名密码什么的都可以改,需要指出的是:

CN=cas.example.org这段内容,后边配置客户端的时候需要用到,一定要确保能通过这个域名访问到你的CAS服务端。

并且不能使用IP作为域(上文的CN),使用IP虽然可以生成keystore,但是在客户端使用的时候,如果服务端地址配置成IP会报错。

这里我的CAS服务端是部署在本地的,所以需要做一个本地映射——

用管理员身份修改C:\Windows\System32\drivers\etc\hosts文件,在其最后加上以下内容:

  1. 127.0.0.1 cas.example.org

这样,我们在本地访问这个域名,其实访问的就是我们本机了。

再说https:

Tomcat8.5配置https的方式相较之前的版本有所调整,不过也差不太多,修改server.xml文件,如下:

  1. <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
  2. maxThreads="150" SSLEnabled="true">
  3. <SSLHostConfig>
  4. <Certificate certificateKeystoreFile="D:/liuyx.keystore"
  5. type="RSA" certificateKeystoreType="JKS" certificateKeystorePassword="123456"/>
  6. </SSLHostConfig>
  7. </Connector>

注意,别忘了把8080端口的Connector注释掉:

  1. <!-- <Connector port="8080" protocol="HTTP/1.1"
  2. connectionTimeout="20000"
  3. redirectPort="8443" />-->

最后是从数据库中读取用户:

这里我们要做这么几件事:

  1、在pom中引入数据库相关的jar包,注释掉用不到的jar包

pom如下:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd ">
  5. <modelVersion>4.0.0</modelVersion>
  6. <groupId>org.apereo.cas</groupId>
  7. <artifactId>cas-overlay</artifactId>
  8. <packaging>war</packaging>
  9. <version>1.0</version>
  10.  
  11. <build>
  12. <plugins>
  13. <!--STEP1 注释掉无用组件
  14. <plugin>
  15. <groupId>com.rimerosolutions.maven.plugins</groupId>
  16. <artifactId>wrapper-maven-plugin</artifactId>
  17. <version>0.0.4</version>
  18. <configuration>
  19. <verifyDownload>true</verifyDownload>
  20. <checksumAlgorithm>MD5</checksumAlgorithm>
  21. </configuration>
  22. </plugin>-->
  23. <plugin>
  24. <groupId>org.springframework.boot</groupId>
  25. <artifactId>spring-boot-maven-plugin</artifactId>
  26. <version>${springboot.version}</version>
  27. <configuration>
  28. <mainClass>org.springframework.boot.loader.WarLauncher</mainClass>
  29. <addResources>true</addResources>
  30. </configuration>
  31. </plugin>
  32. <plugin>
  33. <groupId>org.apache.maven.plugins</groupId>
  34. <artifactId>maven-war-plugin</artifactId>
  35. <version>2.6</version>
  36. <configuration>
  37. <warName>cas</warName>
  38. <failOnMissingWebXml>false</failOnMissingWebXml>
  39. <recompressZippedFiles>false</recompressZippedFiles>
  40. <archive>
  41. <compress>false</compress>
  42. <manifestFile>${project.build.directory}/war/work/org.apereo.cas/cas-server-webapp${app.server}/META-INF/MANIFEST.MF
  43. </manifestFile>
  44. </archive>
  45. <overlays>
  46. <overlay>
  47. <groupId>org.apereo.cas</groupId>
  48. <artifactId>cas-server-webapp${app.server}</artifactId>
  49. </overlay>
  50. </overlays>
  51. </configuration>
  52. </plugin>
  53. <plugin>
  54. <groupId>org.apache.maven.plugins</groupId>
  55. <artifactId>maven-compiler-plugin</artifactId>
  56. <version>3.3</version>
  57. </plugin>
  58. </plugins>
  59. <finalName>cas</finalName>
  60. </build>
  61.  
  62. <dependencies>
  63. <dependency>
  64. <groupId>org.apereo.cas</groupId>
  65. <artifactId>cas-server-webapp${app.server}</artifactId>
  66. <version>${cas.version}</version>
  67. <type>war</type>
  68. <scope>runtime</scope>
  69. </dependency>
  70. <!--STEP2 引入数据库认证相关 start-->
  71. <dependency>
  72. <groupId>org.apereo.cas</groupId>
  73. <artifactId>cas-server-support-jdbc</artifactId>
  74. <version>${cas.version}</version>
  75. </dependency>
  76. <dependency>
  77. <groupId>org.apereo.cas</groupId>
  78. <artifactId>cas-server-support-jdbc-drivers</artifactId>
  79. <version>${cas.version}</version>
  80. </dependency>
  81. <dependency>
  82. <groupId>mysql</groupId>
  83. <artifactId>mysql-connector-java</artifactId>
  84. <version>5.1.36</version>
  85. </dependency>
  86. <!--数据库认证相关 end-->
  87.  
  88. <!--<dependency>
  89. <groupId>org.jasig.cas</groupId>
  90. <artifactId>cas-server-core-authentication</artifactId>
  91. <version>4.2.7</version>
  92. </dependency>-->
  93. <!--<dependency>
  94. <groupId>org.apereo.cas</groupId>
  95. <artifactId>cas-server-core-util</artifactId>
  96. <version>${cas.version}</version>
  97. </dependency>-->
  98. </dependencies>
  99.  
  100. <properties>
  101. <cas.version>5.1.1</cas.version><!--STEP3 修改版本,高版本目前暂时没有相应的JDBC支持-->
  102. <springboot.version>1.5.3.RELEASE</springboot.version>
  103. <!-- app.server could be -jetty, -undertow, -tomcat, or blank if you plan to provide appserver -->
  104. <app.server>-tomcat</app.server>
  105. <maven.compiler.source>1.8</maven.compiler.source>
  106. <maven.compiler.target>1.8</maven.compiler.target>
  107. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  108. </properties>
  109.  
  110. <repositories>
  111. <repository>
  112. <id>sonatype-releases</id>
  113. <url>http://oss.sonatype.org/content/repositories/releases/</url>
  114. <snapshots>
  115. <enabled>false</enabled>
  116. </snapshots>
  117. <releases>
  118. <enabled>true</enabled>
  119. </releases>
  120. </repository>
  121. <repository>
  122. <id>sonatype-snapshots</id>
  123. <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
  124. <snapshots>
  125. <enabled>true</enabled>
  126. </snapshots>
  127. <releases>
  128. <enabled>false</enabled>
  129. </releases>
  130. </repository>
  131. <repository>
  132. <id>shibboleth-releases</id>
  133. <url>https://build.shibboleth.net/nexus/content/repositories/releases</url>
  134. </repository>
  135. <repository>
  136. <id>spring-milestones</id>
  137. <url>https://repo.spring.io/milestone</url>
  138. </repository>
  139. </repositories>
  140. <!--STEP4 注释掉无用组件
  141. <profiles>
  142. <profile>
  143. <activation>
  144. <activeByDefault>false</activeByDefault>
  145. </activation>
  146. <id>pgp</id>
  147. <build>
  148. <plugins>
  149.  
  150. <plugin>
  151. <groupId>com.github.s4u.plugins</groupId>
  152. <artifactId>pgpverify-maven-plugin</artifactId>
  153. <version>1.1.0</version>
  154. <executions>
  155. <execution>
  156. <goals>
  157. <goal>check</goal>
  158. </goals>
  159. </execution>
  160. </executions>
  161. <configuration>
  162. <pgpKeyServer>hkp://pool.sks-keyservers.net</pgpKeyServer>
  163. <pgpKeysCachePath>${settings.localRepository}/pgpkeys-cache</pgpKeysCachePath>
  164. <scope>test</scope>
  165. <verifyPomFiles>true</verifyPomFiles>
  166. <failNoSignature>false</failNoSignature>
  167. </configuration>
  168. </plugin>
  169. </plugins>
  170. </build>
  171. </profile>
  172.  
  173. </profiles>-->
  174. </project>

注意这里我用的cas.version是5.1.1,是因为现在的maven仓库里没有更高版本的cas-server-support-jdbc和cas-server-support-jdbc-drivers,为了保持统一选用的5.1.1,你如果能处理好这些jar包,也可以用高版本。

  2、修改配置文件

观察刚才war包解压出的文件,可以在WEB-INF下发现很多配置文件,

通过阅读:https://apereo.github.io/cas/5.1.x/installation/Configuration-Server-Management.html 得知,我们可以通过修改其中一个application.properties配置文件来使服务端支持从数据库的某张表来验证用户。

具体的配置信息也可以从https://apereo.github.io/cas/5.1.x/installation/Configuration-Server-Management.html 来了解。

为了防止再次打war包的时候,修改的配置被覆盖,我在cas-overlay这个maven项目下新建了src,resources等目录,然后把配置文件复制到相应的目录进行修改,结构如下:

当然你也可以直接在war包解压出来的内容上改。

修改后的application.properties内容如下(在原基础上修改,注释掉一部分用不到的东西):

  1. #STEP 3 在TOMCAT8.5中跑一个模板然后将其war包中解压出来的的application.properties复制出来,放到手动创建的src下的resources里面
  2.  
  3. ##
  4. # CAS Server Context Configuration
  5. #
  6. server.context-path=/cas
  7. server.port=8443
  8.  
  9. #STEP 5添加认证服务
  1. cas.serviceRegistry.initFromJson=true
  2.  
  3. #STEP 4签发证书,如果是用spring boot之类嵌入式的容器,则需要改这里的配置,如果是直接部在tomcat中,则需要把tomcat改成https的
  4. #server.ssl.key-store=file:/etc/cas/thekeystore
  5. #server.ssl.key-store-password=changeit
  6. #server.ssl.key-password=changeit
  7. # server.ssl.ciphers=
  8. # server.ssl.client-auth=
  9. # server.ssl.enabled=
  10. # server.ssl.key-alias=
  11. # server.ssl.key-store-provider=
  12. # server.ssl.key-store-type=
  13. # server.ssl.protocol=
  14. # server.ssl.trust-store=
  15. # server.ssl.trust-store-password=
  16. # server.ssl.trust-store-provider=
  17. # server.ssl.trust-store-type=
  18.  
  19. #server.max-http-header-size=2097152
  20. #server.use-forward-headers=true
  21. #server.connection-timeout=20000
  22. #server.error.include-stacktrace=NEVER
  23.  
  24. #server.tomcat.max-http-post-size=2097152
  25. #server.tomcat.basedir=build/tomcat
  26. #server.tomcat.accesslog.enabled=true
  27. #server.tomcat.accesslog.pattern=%t %a "%r" %s (%D ms)
  28. #server.tomcat.accesslog.suffix=.log
  29. #server.tomcat.max-threads=10
  30. #server.tomcat.port-header=X-Forwarded-Port
  31. #server.tomcat.protocol-header=X-Forwarded-Proto
  32. #server.tomcat.protocol-header-https-value=https
  33. #server.tomcat.remote-ip-header=X-FORWARDED-FOR
  34. #server.tomcat.uri-encoding=UTF-8
  35.  
  36. spring.http.encoding.charset=UTF-8
  37. spring.http.encoding.enabled=true
  38. spring.http.encoding.force=true
  39.  
  40. ##
  41. # CAS Cloud Bus Configuration
  42. #
  43. spring.cloud.bus.enabled=false
  44. # spring.cloud.bus.refresh.enabled=true
  45. # spring.cloud.bus.env.enabled=true
  46. # spring.cloud.bus.destination=CasCloudBus
  47. # spring.cloud.bus.ack.enabled=true
  48.  
  49. endpoints.enabled=false
  50. endpoints.sensitive=true
  51.  
  52. endpoints.restart.enabled=false
  53. endpoints.shutdown.enabled=false
  54.  
  55. management.security.enabled=true
  56. management.security.roles=ACTUATOR,ADMIN
  57. management.security.sessions=if_required
  58. management.context-path=/status
  59. management.add-application-context-header=false
  60.  
  61. security.basic.authorize-mode=role
  62. security.basic.enabled=false
  63. security.basic.path=/cas/status/**
  64.  
  65. ##
  66. # CAS Web Application Session Configuration
  67. #
  68. server.session.timeout=300
  69. server.session.cookie.http-only=true
  70. server.session.tracking-modes=COOKIE
  71.  
  72. ##
  73. # CAS Thymeleaf View Configuration
  74. #
  75. spring.thymeleaf.encoding=UTF-8
  76. spring.thymeleaf.cache=false
  77. spring.thymeleaf.mode=HTML
  78. ##
  79. # CAS Log4j Configuration
  80. #
  81. # logging.config=file:/etc/cas/log4j2.xml
  82. server.context-parameters.isLog4jAutoInitializationDisabled=true
  83.  
  84. ##
  85. # CAS AspectJ Configuration
  86. #
  87. spring.aop.auto=true
  88. spring.aop.proxy-target-class=true
  89.  
  90. ##
  91. # CAS Authentication Credentials
  92. #
  93. #STEP4 注释掉写死的用户 改用jdbc的用户 START
  94. #cas.authn.accept.users=casuser::Mellon
  95. cas.authn.jdbc.query[0].sql=select * from cms_auth_user where user_name=?
  96. cas.authn.jdbc.query[0].healthQuery=
  97. cas.authn.jdbc.query[0].isolateInternalQueries=false
  98. cas.authn.jdbc.query[0].url=jdbc:mysql://127.0.0.1:3306/CASTEST?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
  99. cas.authn.jdbc.query[0].failFast=true
  100. cas.authn.jdbc.query[0].isolationLevelName=ISOLATION_READ_COMMITTED
  101. cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQLDialect
  102. cas.authn.jdbc.query[0].leakThreshold=10
  103. cas.authn.jdbc.query[0].propagationBehaviorName=PROPAGATION_REQUIRED
  104. cas.authn.jdbc.query[0].batchSize=1
  105. cas.authn.jdbc.query[0].user=root
  106. #cas.authn.jdbc.query[0].ddlAuto=create-drop
  107. cas.authn.jdbc.query[0].maxAgeDays=180
  108. cas.authn.jdbc.query[0].password=123456
  109. cas.authn.jdbc.query[0].autocommit=false
  110. cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver
  111. cas.authn.jdbc.query[0].idleTimeout=5000
  112. # cas.authn.jdbc.query[0].credentialCriteria=
  113. # cas.authn.jdbc.query[0].name=
  114. # cas.authn.jdbc.query[0].order=0
  115. # cas.authn.jdbc.query[0].dataSourceName=
  116. # cas.authn.jdbc.query[0].dataSourceProxy=false
  117. cas.authn.jdbc.query[0].fieldPassword=password

  118. # cas.authn.jdbc.query[0].fieldExpired=
  119. # cas.authn.jdbc.query[0].fieldDisabled=
  120. # cas.authn.jdbc.query[0].principalAttributeList=sn,cn:commonName,givenName
  121.  
  122. #cas.authn.jdbc.query[0].passwordEncoder.type=DEFAULT
  123. #cas.authn.jdbc.query[0].passwordEncoder.type=com.example.CustomPasswordEncoder
  124. #cas.authn.jdbc.query[0].passwordEncoder.characterEncoding=UTF-8
  125. #cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=MD5
  126.  
  127. #cas.authn.jdbc.query[0].passwordEncoder.secret=
  128. #cas.authn.jdbc.query[0].passwordEncoder.strength=16
  129.  
  130. # cas.authn.jdbc.query[0].principalTransformation.suffix=
  131. # cas.authn.jdbc.query[0].principalTransformation.caseConversion=NONE|UPPERCASE|LOWERCASE
  132. # cas.authn.jdbc.query[0].principalTransformation.prefix=
  133. # STEP4 END
  134.  
  135. ##
  136. # CAS Delegated Authentication
  137. #
  138. #cas.authn.pac4j.bitbucket.clientName=Bitbucket
  139. #cas.authn.pac4j.dropbox.clientName=Dropbox
  140. #cas.authn.pac4j.facebook.clientName=Facebook
  141. #cas.authn.pac4j.foursquare.clientName=Foursquare
  142. #cas.authn.pac4j.github.clientName=Github
  143. #cas.authn.pac4j.google.clientName=Google
  144. #cas.authn.pac4j.linkedIn.clientName=LinkedIn
  145. #cas.authn.pac4j.paypal.clientName=PayPal
  146. #cas.authn.pac4j.twitter.clientName=Twitter
  147. #cas.authn.pac4j.yahoo.clientName=Yahoo
  148. #cas.authn.pac4j.windowsLive.clientName=Windows Live
  149. #cas.authn.pac4j.wordpress.clientName=WordPress
  150.  
  151. #多属性
  152. cas.authn.attributeRepository.jdbc[0].singleRow=true
  153. cas.authn.attributeRepository.jdbc[0].order=0
  154. cas.authn.attributeRepository.jdbc[0].url=jdbc:mysql://127.0.0.1:3306/CASTEST?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
  155. cas.authn.attributeRepository.jdbc[0].username=user_name
  156. cas.authn.attributeRepository.jdbc[0].user=root
  157. cas.authn.attributeRepository.jdbc[0].password=123456
  158. cas.authn.attributeRepository.jdbc[0].sql=select * from cms_auth_user where {0}
  159. cas.authn.attributeRepository.jdbc[0].dialect=org.hibernate.dialect.MySQLDialect
  160. cas.authn.attributeRepository.jdbc[0].ddlAuto=none
  161. cas.authn.attributeRepository.jdbc[0].driverClass=com.mysql.jdbc.Driver
  162. cas.authn.attributeRepository.jdbc[0].leakThreshold=10
  163. cas.authn.attributeRepository.jdbc[0].propagationBehaviorName=PROPAGATION_REQUIRED
  164. cas.authn.attributeRepository.jdbc[0].batchSize=1
  165. cas.authn.attributeRepository.jdbc[0].healthQuery=SELECT 1
  166. cas.authn.attributeRepository.jdbc[0].failFast=true

其中加粗标蓝的都是我修改的内容,简单说一下:

cas.authn.accept.users=casuser::Mellon这个配置记得删掉,这就是那个写死的用户

cas.authn.jdbc.query[0]这些配置就是数据库验证相关的内容

在cas.authn.jdbc.query[0].sql中,程序会把你登录时输入的用户名作为参数传进去

cas.authn.jdbc.query[0].fieldPassword则是指明那一列对应的是你输入的密码,目前没有做MD5,怎么做MD5下一篇一起说。

至此这节该说的说完了,有些朋友可能会纳闷配置文件中的其它标蓝加粗内容是干什么的,不要急我们下节再讲,你可以先把这些我没提到的标蓝内容删掉,跑起来试试现在服务端是否真的通过数据库验证了。

CAS 5.1.x 的搭建和使用(一)—— 通过Overlay搭建服务端的更多相关文章

  1. CAS (8) —— Mac下配置CAS到JBoss EAP 6.4(6.x)的Standalone模式(服务端)

    CAS (8) -- Mac下配置CAS到JBoss EAP 6.4(6.x)的Standalone模式(服务端) jboss版本: jboss-eap-6.4-CVE-2015-7501 jdk版本 ...

  2. Oracle服务端及客户端搭建帮助文档

    Oracle服务端及客户端搭建帮助文档 目录 简介 Oracle服务端安装 Oracle客户端安装 PLSQL安装 登录测试 系统配置修改 用户操作 解锁账户.密码 创建账户及密码 配置监听文件 监听 ...

  3. CAS 5.1.x 的搭建和使用(四)—— 配置使用HTTP协议访问的服务端

    CAS单点登录系列: CAS 5.1.x 的搭建和使用(一)—— 通过Overlay搭建服务端 CAS5.1.x 的搭建和使用(二)—— 通过Overlay搭建服务端-其它配置说明 CAS5.1.x ...

  4. CAS 5.1.x 的搭建和使用(二)—— 通过Overlay搭建服务端-其它配置说明

    CAS单点登录系列: CAS 5.1.x 的搭建和使用(一)—— 通过Overlay搭建服务端 CAS5.1.x 的搭建和使用(二)—— 通过Overlay搭建服务端-其它配置说明 CAS5.1.x ...

  5. CAS单点登录学习(一):服务端搭建

    下载先在网上下载cas-server-3.5.2,将里面的cas-server-webapp-3.5.2.war放到tomcat的webapps目录下. https设置cas单点登默认使用的是http ...

  6. Apereo CAS Server服务端搭建教程

    不说废话了,直接看搭建过程吧. 首先到下载源码,https://github.com/apereo/cas-overlay-template/tree/4.2 附上地址,本次版本为4.2,下载源码后如 ...

  7. 轻松搭建CAS 5.x系列(1)-使用cas overlay搭建SSO SERVER服务端

    概要说明 cas的服务端搭建有两种常用的方式:   1. 基于源码的基础上构建出来的   2. 使用WAR overlay的方式来安装 官方推荐使用第二种,配置管理方便,以后升级也容易.本文就是使用第 ...

  8. 三、记一次失败的 CAS 搭建 之 服务端配置

    ==================================================================================================== ...

  9. CAS单点登录之服务端部署

    一.CAS服务端搭建 1.1 CAS支持Http登录配置 CAS默认是要https的链接才能登录的,不过学习的话是可以先去掉https限制,本博客介绍的是基于Cas4.2.7的,之前改过4.0的,详情 ...

随机推荐

  1. JSTL fmt 格式化时间

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  2. tcp_client.c tcp_server.c

    #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <string.h> ...

  3. Guava Files 源码分析(一)

    Files中的工厂 Files类中对InputStream, OutputStream以及Reader,Writer的操作封装了抽象工厂模式,抽象工厂是InputSupplier与OutputSupp ...

  4. UI_UITabBarController

    建立控制器 // 普通控制器 GroupViewController *groupVC = [[GroupViewController alloc] init]; SecondViewControll ...

  5. spark调优经验(待续)

    spark调优是须要依据业务须要调整的,并非说某个设置是一成不变的,就比方机器学习一样,是在不断的调试中找出当前业务下更优的调优配置.以下零碎的总结了一些我的调优笔记. spark 存储的时候存在严重 ...

  6. @Logback简介

    Ceki Gülcü在Java日志领域世界知名.他创造了Log4J,这个最早的Java日志框架即便在JRE内置日志功能的竞争下仍然非常流行.随后他又着手实现SLF4J这个"简单的日志前端接口 ...

  7. 数学图形之罗马曲面(RomanSurface)

    罗马曲面,像是一个被捏扁的正四面体. 本文将展示罗马曲面的生成算法和切图,使用自己定义语法的脚本代码生成数学图形.相关软件参见:数学图形可视化工具,该软件免费开源.QQ交流群: 367752815 维 ...

  8. WhyDemo: 画线圈LineFlower

    画线圈LineFlower 刚发过画线圈的屏保程序,现在发一下它的可编辑版本.可以对线圈的相关参数进行设置.      小时候玩过一种画线圈的玩具,将一个圆形齿轮在一个大圈里转,会画出各种图形来.这个 ...

  9. 第四章 mybatis批量insert

    批量插入sql语句: INSERT INTO table (field1,field2,field3) VALUES ('a',"b","c"), ('a',& ...

  10. Java JDBC数据库链接

    好久没有编写有关数据库应用程序啦,这里回顾一下java JDBC. 1.使用Java JDBC操作数据库一般需要6步: (1)建立JDBC桥接器,加载数据库驱动: (2)连接数据库,获得Connect ...