从快照恢复 Cassandra 时出现错误

问题描述 投票:0回答:1

我们正在 Docker 中运行 JanusGraph 以及 Cassandra 和 Elasticsearch 的两个集群。

version: "3"

services:
  janusgraph:
    image: local-janusgraph:latest
    container_name: jce-janusgraphdb
    environment:
      JANUS_PROPS_TEMPLATE: cql-es
      janusgraph.storage.hostname: jce-cassandra-1,jce-cassandra-2
      janusgraph.index.search.hostname: jce-elastic-1,jce-elastic-2
    ports:
      - "8182:8182"
    networks:
      - jce-network
    volumes:
      - janusgraph-data:/var/lib/janusgraph  # Mounts a volume to JanusGraph

  cassandra-1:
    image: cassandra:3
    container_name: jce-cassandra-1
    environment:
      CASSANDRA_SEEDS: "jce-cassandra-1,jce-cassandra-2"
      CASSANDRA_CLUSTER_NAME: "janusgraph-cluster"
    networks:
      - jce-network
    ports:
      - "9042:9042"
      - "9160:9160"
    volumes:
      - cassandra1-data:/var/lib/cassandra  # Mounts a volume to Cassandra

  cassandra-2:
    image: cassandra:3
    container_name: jce-cassandra-2
    environment:
      CASSANDRA_SEEDS: "jce-cassandra-1,jce-cassandra-2"
      CASSANDRA_CLUSTER_NAME: "janusgraph-cluster"
    networks:
      - jce-network
    volumes:
      - cassandra2-data:/var/lib/cassandra  # Mounts a volume to Cassandra

  elasticsearch-1:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.6.0
    container_name: jce-elastic-1
    environment:
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "network.host=0.0.0.0"
      - "discovery.zen.ping.unicast.hosts=jce-elastic-1,jce-elastic-2"
    ports:
      - "9200:9200"
    networks:
      - jce-network
    volumes:
      - esdata1:/usr/share/elasticsearch/data  # Mounts a volume to Elasticsearch

  elasticsearch-2:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.6.0
    container_name: jce-elastic-2
    environment:
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "network.host=0.0.0.0"
      - "discovery.zen.ping.unicast.hosts=jce-elastic-1,jce-elastic-2"
    networks:
      - jce-network
    volumes:
      - esdata2:/usr/share/elasticsearch/data  # Mounts a volume to Elasticsearch

networks:
  jce-network:

volumes:
  janusgraph-data:
  cassandra1-data:
  cassandra2-data:
  esdata1:
  esdata2:

Dockerfile如下

FROM docker.io/janusgraph/janusgraph:latest

WORKDIR /opt/janusgraph
USER root

# Copy configuration files
COPY janusgraph-server.yaml /opt/janusgraph/conf/janusgraph-server.yaml
COPY empty-sample.groovy /opt/janusgraph/scripts/empty-sample.groovy
COPY janusgraph-keyspace-one.properties /opt/janusgraph/conf/janusgraph-keyspace-one.properties
COPY janusgraph-keyspace-two.properties /opt/janusgraph/conf/janusgraph-keyspace-two.properties

# Set ownership for the entire conf directory in one step
# RUN chown -R janusgraph:janusgraph /opt/janusgraph/conf

USER janusgraph

WORKDIR /opt/janusgraph

我们有两个名为

keyspace_one
keyspace_two
的键空间,我们正在尝试按照命令拍摄键空间
keyspace_one
的快照。

docker exec -it jce-cassandra-1 nodetool snapshot keyspace_one

我们已成功创建快照文件夹,一切正常。现在,我们正在尝试将备份的快照恢复到

keyspace_two
。为此,我们将快照数据复制到文档中所述的
keyspace_two
文件夹中。接下来,我们执行刷新键空间的命令。

nodetool refresh keyspace_two edgestore

我们遇到以下错误:

root@cec647038c56:/var/lib/cassandra/data/keyspace_two# nodetool refresh keyspace_two edgestore
error: null
-- StackTrace --
java.lang.AssertionError
    at org.apache.cassandra.db.PartitionColumns$Builder.add(PartitionColumns.java:161)
    at org.apache.cassandra.db.SerializationHeader$Component.toHeader(SerializationHeader.java:340)
    at org.apache.cassandra.io.sstable.format.SSTableReader.open(SSTableReader.java:522)
    at org.apache.cassandra.io.sstable.format.SSTableReader.open(SSTableReader.java:385)
    at org.apache.cassandra.db.ColumnFamilyStore.loadNewSSTables(ColumnFamilyStore.java:801)
    at org.apache.cassandra.db.ColumnFamilyStore.loadNewSSTables(ColumnFamilyStore.java:739)
    at org.apache.cassandra.service.StorageService.loadNewSSTables(StorageService.java:5404)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:72)
    at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:276)
    at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112)
    at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46)
    at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237)
    at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138)
    at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
    at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
    at sun.rmi.transport.Transport$1.run(Transport.java:200)
    at sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:750)

是否有我们可能忽略的配置或命令?

docker elasticsearch cassandra janusgraph
1个回答
0
投票

只是一个想法,但这可能仅在目标键空间名称与源相同时才有效。

在快照文件的目录中,查看生成的

schema.cql
文件。尝试将该文件中对
keyspace_1
的所有引用设置为
keyspace_2
,然后再次运行刷新。

© www.soinside.com 2019 - 2024. All rights reserved.