Skip to content

Instantly share code, notes, and snippets.

@caisan
caisan / content.md
Created April 12, 2023 02:50 — forked from baymaxium/content.md
ceph中对象读写的顺序性及并发性保证

原文:架构师

架构师(JiaGouX)

我们都是架构师!

分布式系统中经常需要考虑对象(或者记录、文件、数据块等)的读写的顺序以及并发访问问题。通常来说,如果两个对象没有共享的资源,就可以进行并发的访问,如果有共享的部分,就需要对这部分资源进行加锁;而对于同一个对象的并发读写(尤其是并发写更新时),就需要注意顺序性以及并发访问的控制,以免数据错乱。本文主要对ceph中对象读写的顺序及并发性保证机制进行介绍。

PG的概念

@caisan
caisan / s3-get.sh
Created March 22, 2023 07:52 — forked from mmaday/s3-get.sh
S3 signed GET in plain bash (Requires openssl and curl)
#!/usr/bin/env bash
#
# Usage:
# s3-get.sh <bucket> <region> <source-file> <dest-path>
#
# Description:
# Retrieve a secured file from S3 using AWS signature 4.
# To run, this shell script depends on command-line curl and openssl
#
# References:
@caisan
caisan / s3-get.sh
Created March 22, 2023 07:52 — forked from mmaday/s3-get.sh
S3 signed GET in plain bash (Requires openssl and curl)
#!/usr/bin/env bash
#
# Usage:
# s3-get.sh <bucket> <region> <source-file> <dest-path>
#
# Description:
# Retrieve a secured file from S3 using AWS signature 4.
# To run, this shell script depends on command-line curl and openssl
#
# References:
@caisan
caisan / content.md
Created October 11, 2022 07:03 — forked from baymaxium/content.md
ceph存储引擎bluestore解析

原文:架构师

架构师(JiaGouX)

我们都是架构师!

ceph后端支持多种存储引擎,以插件式的方式来进行管理使用,目前支持filestore,kvstore,memstore以及最新的bluestore,目前默认使用的filestore,但是因为filestore在写数据前需要先写journal,会有一倍的写放大,并且filestore一开始只是对于机械盘进行设计的,没有专门针对ssd做优化考虑,因此诞生的bluestore初衷就是为了减少写放大,并针对ssd做优化,而且直接管理裸盘,从理论上进一步减少文件系统如ext4/xfs等部分的开销,目前bluestore还处于开发优化阶段,在jewel版本还是试用版本,并且最新的master相比jewel已经做了大的重构,预期会在后续的大版本中稳定下来成为默认的存储引擎。本文基于master分支对bluestore存储引擎进行分析。

bluestore整体架构

@caisan
caisan / nbd.py
Created August 31, 2022 08:08 — forked from gabriel-samfira/nbd.py
python NBD client
# Copyright 2017 Cloudbase Solutions SRL
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software

vstart

setup

  • start:
MON=1 OSD=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh -n -d -o rgw_max_objs_per_shard=50 -o rgw_reshard_thread_interval=60
  • verify the number was set, and that dynamic reshard is enabled:
bin/ceph -c ceph.conf daemon out/radosgw.8000.asok config get rgw_max_objs_per_shard
bin/ceph -c ceph.conf daemon out/radosgw.8000.asok config get rgw_dynamic_resharding
@caisan
caisan / rgw_multisite_tests.md
Created February 22, 2022 10:06 — forked from yuvalif/rgw_multisite_tests.md
Ceph RGW multisite tests suite

Running Tests Locally

  • you run the tests locally from your "build" directory in your test environment
  • then you need to add a "test_multi.conf" file:
[DEFAULT]
num_zonegroups=1
num_zones=1
num_ps_zones=0
gateways_per_zone=1
@caisan
caisan / virt-install-centos
Created December 9, 2021 12:11 — forked from jnaulty/virt-install-centos
Install CentOS cloud images on KVM using cloud-init
#!/bin/bash
## **Updates to this file are now at https://github.com/giovtorres/kvm-install-vm.**
## **This updated version has more options and less hardcoded variables.**
# Take one argument from the commandline: VM name
if ! [ $# -eq 1 ]; then
echo "Usage: $0 <node-name>"
exit 1
fi
@caisan
caisan / KVM Attempt 1
Created December 9, 2021 11:36 — forked from ilude/KVM Attempt 1
KVM virt-install command
qemu-img create -f qcow2 /pool/vms/xp.qcow2 50G
sudo virt-install --connect qemu:///system -n xp -r 512 --disk path=/pool/vms/xp.qcow2,size=50 \
-c /pool/iso/windows/en_windows_xp_professional_with_service_pack_3_x86_cd_vl_x14-73974.iso \
--graphics vnc,listen=0.0.0.0,port=65322 --noautoconsole \
--os-type windows --os-variant winxp
@caisan
caisan / qemu-networking.md
Created October 6, 2020 08:50 — forked from extremecoders-re/qemu-networking.md
Setting up Qemu with a tap interface

Setting up Qemu with a tap interface

There are two parts to networking within QEMU:

  • The virtual network device that is provided to the guest (e.g. a PCI network card).
  • The network backend that interacts with the emulated NIC (e.g. puts packets onto the host's network).

Example: User mode network