ITeye博客

theseus

theseus · 共 49 篇文章

Spring repository操作Cassandra

1、定义接口 通过继承 CrudRepository实现数据的基本操作 public interface PersonRepository extends CrudRepository<Person, String> { List<Person> findByNameLike(String name); } 2、Cassandra的配置 继承 AbstractCassandraConfiguration,指定默认的库,并添加EnableCassandraRepositories注解 @Configuration @EnableCassandraRepositories public clas…

2018-12-16 16:08 · DB · Spring · 评论(0)

Cassandra的数据一致性策略

一致性要求每次的请求都能返回最新的数据结果,数据库的每次更新所有的客户端请求都能得到相同的返回结果。分布式数据库Cassandra也是基于CAP理论来实现的,并采用了AP,因此在数据一致性方面做出牺牲。 除单一的一致性概念之外还有一致性度的区分,严格一致性是最强度的模型,该模型要求每次的数据读取必须返回最新写入的值。在分布式系统中实现严格一致性显然是不现实的,实际当中我们忽略系统的异常因素及其网络失败造成的数据无法更新,从而导致系统数据为不可用状态。最终一致性则是要求系统所有的更新最终都应用到所有的副本节点中,在此过程中可以以消耗一定时间为代价,虽然在某个时间节点副本数据是不一致的,但经过一…

2018-12-02 22:58 · DB · 评论(0)

Cassandra的数据建模

Cassandra的数据建模主要是基于查询来设计数据的存储,主要体现在以下两方面: 定义数据的访问模式; 后续将使用的查询功能; 这两点将决定如何组织数据同时也决定数据库表的设计及创建。 Cassandra同关系数据库在数据建模上的不同点: 数据建模作为一个结构化的过程主要解决以下问题: 1、收集分析信息系统所需数据 2、定义系统中的实体及其之间的关系 3、定义数据的访问模式 4、使用特定方式组织并结构化数据 5、设计并定义数据库模式 6、优化数据库模式 数据建模的具体过程包含以下关键步骤:

2018-11-14 23:24 · DB · 评论(0)

MongoDB

Mongo内嵌文档添加自段 db.books.update({},{$set:{"authors.0.field":"value"}})

2018-09-13 20:35 · DB · 评论(0)

RabbitMQ实战

1、Python脚本 安装后打开http://localhost:15672/cli/,右键另存为py文件 脚本使用说明 rabbitmqadmin.py help rabbitmqadmin.py help subcommands 2、用户管理 新增 rabbitmqctl add_user 用户名 密码 授权 rabbitmqctl.bat set_user_tags 用户名 角色 用户列表 rabbitmqctl.bat list_users 更改密码 rabbitmqctl.bat change_password 用户 新密码 删除用户 rabbitmqctl.bat delete_…

2018-07-20 10:47 · MQ · 中间件 · 评论(0)

Hadoop之Hive

Hive基本介绍 查询管理存储在HDFS中的大数据集合,提供像SQL的查询语句HiveQL。Hive表的元数据存储在Derby数据库中,Mysql和Oracle也可以作为Hive的存储源 Hive操作 use:切换数据库 hive> use default; OK Time taken: 0.454 seconds hive> show tables; OK categories customers departments intermediate_access_logs order_items orders products tokenized_access_logs wlslog Tim…

2018-06-17 18:00 · hadoop · 评论(0)

Java IO, NIO,NIO2

1、I-O RandomAccessFile 构造方法中mode参数说明: r: 只读打开 rw: 读写模式,文件不存在创建新文件 rwd:读写模式打开文件,文件内容写入同步更新到存储 rws:文件内容与元数据()写入同步更新到存储 FileDescriptor sync() 将输出缓存区的内容写入存储设备,抛SyncFailedException,当缓存区不能被刷新或者系统没有授权同步物理介质 valid() 当文件描述对象为文件打开或激活的IO链接时返回true 处理字节序列 OutputStream ByteArrayOutputStream FileOutputStream Filt…

2018-06-07 17:18 · Java · 评论(0)

linux常用命令收集

ssh安装:yum install openssh-server netstat安装: yum install net-tools 开机启动设置 ssh chkconfig sshd on centos7 systemctl enable sshd 用户获取sudo权限 a)usermod -a -G wheel 用户名 b)vi /etc/sudoers Same thing without a password %wheel ALL=(ALL) NOPASSWD: ALL cos4 ALL=(ALL) NOPASSWD: ALL SecureCRT连接修改 /etc/sshd/sshd_…

2018-05-10 11:19 · Linux · 评论(0)

MongoDB伪分布集群搭建

OS:CentOS7 MongoDB 版本:3.6 安装 创建Mongo的yum源文件 vi /etc/yum.repos.d/mongodb-org-3.6.repo 替换为阿里源 [mongodb-org-3.6] name=MongoDB Repository baseurl=http://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/3.6/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc 安装…

2018-04-22 16:33 · DB · 评论(0)

SpringBoot中的日志配置

默认采用Logback打印日志 文件名:logback-spring.xml,SpringBoot自动加载xml文件 日志具体配置说明 <configuration> <!--在控制台显示日志颜色--> <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging…

2018-04-10 14:15 · Spring · 评论(0)

基于Spring Cloud的微服务实现

微服务作为当前的流行架构设计,Spring Cloud通过与Spring的集成使微服务的应用更为简便。在Spring Cloud中集成了Netflix的多个开源组件,再通过Spring Boot的注解调用实现插件式的功能调用。 初步架构设计图 1、注册中心-Eureka 提供服务的动态注册、发现 启用Eureka,在pom中添加 <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka-server</artifactId> </dependency> 服…

2017-12-10 14:58 · Spring · 评论(0)

Spring Cloud之Config

Spring Cloud中通过子项目spring-cloud-config实现了基于git、svn等的分布式配置管理,为微服务的构建提供便利条件。 http访问规则 /{application}/{profile}[/{label}] /{application}-{profile}.yml /{label}/{application}-{profile}.yml /{application}-{profile}.properties /{label}/{application}-{profile}.properties application:应用名称,对应客户端配置中的spring.co…

2017-11-09 20:46 · Spring · 评论(0)

SpringMVC日期绑定

在controller中添加以下代码自动绑定日期参数 @InitBinder public void initData(WebDataBinder wdb) { wdb.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true)); }

2017-10-24 15:48 · Spring · 评论(0)

CentOS7安装Zabbix3.4

1、添加rpm源 rpm --import http://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX rpm -Uv http://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm 2、安装相关软件包 yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent 3、本机需安装Mysql数据库,创建zabbix数据库并导入脚本 create database…

2017-10-20 08:14 · 中间件 · 评论(0)

Maven install的使用方法

mvn install:install-file -Dfile=path -DgroupId=groupid -DartifactId=artifactid -Dversion=version -Dpackaging=jar

2017-10-11 10:14 · 中间件 · 评论(0)