### Example: Start profiler for OSD.1 Source: https://docs.ceph.com/en/reef/_sources/rados/troubleshooting/memory-profiling.rst.txt An example of starting the heap profiler for a specific OSD daemon. ```bash ceph tell osd.1 heap start_profiler ``` -------------------------------- ### Example: Get Help for 'log_file' Option Source: https://docs.ceph.com/en/reef/rados/configuration/ceph-conf Demonstrates how to get help for the `log_file` configuration option. ```bash ceph config help log_file ``` -------------------------------- ### Start Example Ceph Daemon Instances with systemd Source: https://docs.ceph.com/en/reef/rados/operations/operating Examples of starting specific OSD, MON, and MDS daemon instances. ```bash sudo systemctl start ceph-osd@1 sudo systemctl start ceph-mon@ceph-server sudo systemctl start ceph-mds@ceph-server ``` -------------------------------- ### Example: Start Ceph OSD Services Source: https://docs.ceph.com/en/reef/install/manual-freebsd-deployment Examples of starting OSD 0 and OSD 1 services. ```bash sudo service ceph start osd.0 sudo service ceph start osd.1 ``` -------------------------------- ### Example: Enable OSD Daemon Start at Reboot Source: https://docs.ceph.com/en/reef/install/manual-freebsd-deployment Examples of creating the bsdrc file for OSD 0 and OSD 1. ```bash sudo touch /var/lib/ceph/osd/ceph-0/bsdrc sudo touch /var/lib/ceph/osd/ceph-1/bsdrc ``` -------------------------------- ### Example: Start a Specific Cluster Source: https://docs.ceph.com/en/reef/dev/dev_cluster_deployment An example of invoking mstart.sh to start a cluster named 'cluster1' with the '-n' option. ```bash ./mstart.sh cluster1 -n ``` -------------------------------- ### Start a specific Ceph daemon instance (example) Source: https://docs.ceph.com/en/reef/_sources/rados/operations/operating.rst.txt Examples of starting specific OSD, MON, or MDS daemon instances using systemd. ```bash sudo systemctl start ceph-osd@1 sudo systemctl start ceph-mon@ceph-server sudo systemctl start ceph-mds@ceph-server ``` -------------------------------- ### Start Crimson OSD with SeaStore and Secondary Devices Source: https://docs.ceph.com/en/reef/_sources/dev/crimson/crimson.rst.txt This example demonstrates starting a Crimson OSD cluster with SeaStore as the backend, specifying primary and secondary block devices, and configuring the secondary device type. ```bash MGR=1 MON=1 OSD=1 MDS=0 RGW=0 ../src/vstart.sh -n -x \ --without-dashboard --seastore \ --crimson --redirect-output \ --seastore-devs /dev/sda \ --seastore-secondary-devs /dev/sdb \ --seastore-secondary-devs-type HDD ``` -------------------------------- ### Example: Get Realm Source: https://docs.ceph.com/en/reef/_sources/radosgw/multisite.rst.txt Example of retrieving information for the 'movies' realm, with output redirected to a file. ```bash radosgw-admin realm get --rgw-realm=movies [> filename.json] ``` -------------------------------- ### Deploy Trivial RGW Setup Source: https://docs.ceph.com/en/reef/_sources/cephadm/services/rgw.rst.txt Example for deploying two radosgw daemons for a single-cluster RGW deployment with the service ID 'foo'. ```bash ceph orch apply rgw foo ``` -------------------------------- ### Building and Serving Seastar Docs Source: https://docs.ceph.com/en/reef/_sources/dev/crimson/crimson.rst.txt Commands to build a browsable version of Seastar documentation and start an HTTP server. Ensure pandoc and other dependencies are installed. ```bash cd seastar ./configure.py --mode debug ninja -C build/debug docs python3 -m http.server -d build/debug/doc/html ``` -------------------------------- ### Enable and Start PCP Service Source: https://docs.ceph.com/en/reef/_sources/rbd/iscsi-monitoring.rst.txt Enable the performance co-pilot service to start on boot and start it immediately. ```bash systemctl enable pmcd systemctl start pmcd ``` -------------------------------- ### Install Git Source: https://docs.ceph.com/en/reef/_sources/dev/generatedocs.rst.txt Installs the Git version control system using apt-get. Ensure Git is installed before cloning the repository. ```bash sudo apt-get install git ``` -------------------------------- ### Enable and Start OSD Service (systemd) Source: https://docs.ceph.com/en/reef/_sources/install/manual-deployment.rst.txt Enable the OSD service to start on boot and then start the OSD process for a given OSD ID. ```bash systemctl enable ceph-osd@$ID systemctl start ceph-osd@$ID ``` ```bash systemctl enable ceph-osd@12 systemctl start ceph-osd@12 ``` -------------------------------- ### Setup Local Frontend Build for Ceph Dashboard Source: https://docs.ceph.com/en/reef/dev/cephadm/developing-cephadm Installs Node.js, navigates to the Ceph dashboard frontend directory, sets ownership, installs dependencies, and starts a local build watcher for the Ceph Dashboard module. This is necessary for applying frontend changes. ```bash # Start local frontend build with watcher (in background): sudo dnf install -y nodejs cd cd src/pybind/mgr/dashboard/frontend sudo chown -R :root dist node_modules NG_CLI_ANALYTICS=false npm ci npm run build -- --deleteOutputPath=false --watch & ``` -------------------------------- ### Example: Deploy Monitors on Specific IPs and Networks Source: https://docs.ceph.com/en/reef/cephadm/services/mon This example demonstrates deploying a second monitor on a specific IP and a third monitor within a given network range. ```bash ceph orch apply mon --unmanaged ceph orch daemon add mon newhost1:10.1.2.123 ceph orch daemon add mon newhost2:10.1.2.0/24 ``` -------------------------------- ### Install Documentation Dependencies Source: https://docs.ceph.com/en/reef/dev/generatedocs Navigates to the ceph directory and runs the build-doc script to install required tools and dependencies for building documentation. If dependencies are missing, this command will suggest installation commands. ```bash cd ceph admin/build-doc ``` -------------------------------- ### Register ZFS Plugin Entry Point Source: https://docs.ceph.com/en/reef/_sources/dev/ceph-volume/plugins.rst.txt Example of registering the ZFS plugin with setuptools in setup.py. ```python entry_points = { 'ceph_volume_handlers': [ 'zfs = ceph_volume_zfs.zfs:ZFS', ], }, ``` -------------------------------- ### Create User Example Source: https://docs.ceph.com/en/reef/_sources/mgr/dashboard.rst.txt Example command to create a new user account, referencing a file containing the password. ```bash ceph dashboard ac-user-create bob -i ``` -------------------------------- ### Example: Create CephFS and List File Systems Source: https://docs.ceph.com/en/reef/cephfs/createfs This example demonstrates creating a file system named 'cephfs' with 'cephfs_metadata' and 'cephfs_data' pools, followed by listing all available file systems to verify the creation. ```bash $ ceph fs new cephfs cephfs_metadata cephfs_data $ ceph fs ls name: cephfs, metadata pool: cephfs_metadata, data pools: [cephfs_data ] ``` -------------------------------- ### Set up the environment Source: https://docs.ceph.com/en/reef/dev/developer_guide/running-tests-locally Source this script to configure your environment for running local tests. ```bash . ./build/vstart_enviroment.sh ``` -------------------------------- ### Example benchmark for 'get osd_map' command Source: https://docs.ceph.com/en/reef/_sources/mgr/cli_api.rst.txt An example of how to benchmark the 'get osd_map' command. This runs the command 100 times using 10 threads to measure its performance. ```bash ceph mgr cli_benchmark 100 10 get osd_map ``` -------------------------------- ### Serve built documentation locally Source: https://docs.ceph.com/en/reef/_sources/start/documenting-ceph.rst.txt Start an HTTP server to view the built documentation locally at http://localhost:8080/. This allows for previewing changes before merging. ```bash admin/serve-doc ``` -------------------------------- ### Clone and Install tcmu-runner Source: https://docs.ceph.com/en/reef/rbd/iscsi-target-cli-manual-install Clones the tcmu-runner repository, installs its dependencies, builds, and installs the component. Ensure to enable and start the tcmu-runner daemon afterwards. ```bash git clone https://github.com/open-iscsi/tcmu-runner cd tcmu-runner ``` ```bash ./extra/install_dep.sh ``` ```bash cmake -Dwith-glfs=false -Dwith-qcow=false -DSUPPORT_SYSTEMD=ON -DCMAKE_INSTALL_PREFIX=/usr make install ``` ```bash systemctl daemon-reload systemctl enable tcmu-runner systemctl start tcmu-runner ``` -------------------------------- ### Start Ceph Upgrade to Specific Version Source: https://docs.ceph.com/en/reef/_sources/cephadm/upgrade.rst.txt Example command to start an upgrade to Ceph version 16.2.6. ```bash ceph orch upgrade start --ceph-version 16.2.6 ``` -------------------------------- ### GET Temp-URL Objects (Example) Source: https://docs.ceph.com/en/reef/radosgw/swift/tempurl Demonstrates how to generate a temporary URL for GET requests using HMAC-SHA1 signature. ```APIDOC ## GET Temp-URL Objects ### Description Temporary URL uses a cryptographic HMAC-SHA1 signature, which includes the following elements: 1. The value of the Request method, “GET” for instance 2. The expiry time, in format of seconds since the epoch, ie Unix time 3. The request path starting from “v1” onwards The above items are normalized with newlines appended between them, and a HMAC is generated using the SHA-1 hashing algorithm against one of the Temp URL Keys posted earlier. A sample python script to demonstrate the above is given below: ```python import hmac from hashlib import sha1 from time import time method = 'GET' host = 'https://objectstore.example.com/swift' duration_in_seconds = 300 # Duration for which the url is valid expires = int(time() + duration_in_seconds) path = '/v1/your-bucket/your-object' key = 'secret' hmac_body = '%s\n%s\n%s' % (method, expires, path) sig = hmac.new(key, hmac_body, sha1).hexdigest() rest_uri = "{host}{path}?temp_url_sig={sig}&temp_url_expires={expires}".format( host=host, path=path, sig=sig, expires=expires) print(rest_uri) # Example Output # https://objectstore.example.com/swift/v1/your-bucket/your-object?temp_url_sig=ff4657876227fc6025f04fcf1e82818266d022c6&temp_url_expires=1423200992 ``` ``` -------------------------------- ### Example: Create Realm Source: https://docs.ceph.com/en/reef/_sources/radosgw/multisite.rst.txt Example of creating a realm named 'movies' and setting it as the default. ```bash radosgw-admin realm create --rgw-realm=movies --default ``` -------------------------------- ### Example Global Configuration Option Source: https://docs.ceph.com/en/reef/_sources/rados/configuration/ceph-conf.rst.txt This example shows a global configuration option for log file path. It demonstrates the use of metavariables. ```ini log_file = /var/log/ceph/$cluster-$type.$id.log ``` -------------------------------- ### Enable and Start Docker Registry Service Source: https://docs.ceph.com/en/reef/_sources/dev/kubernetes.rst.txt Commands to enable and start the docker-distribution service on a system. This assumes the package has already been installed and configured. ```bash systemctl enable docker-distribution systemctl start docker-distribution ``` -------------------------------- ### Serve built documentation locally Source: https://docs.ceph.com/en/reef/start/documenting-ceph Start an HTTP server to preview the built documentation at http://localhost:8080/. This command should be run from the Ceph repository root. ```bash admin/serve-doc ``` -------------------------------- ### MDS Authentication Error Example Source: https://docs.ceph.com/en/reef/install/manual-deployment Example of an authentication error that may occur if the keyring is misconfigured. This indicates a problem with the MDS authentication setup. ```text mds.-1.0 ERROR: failed to authenticate: (22) Invalid argument ``` -------------------------------- ### Start Oprofile Profiling Source: https://docs.ceph.com/en/reef/_sources/rados/troubleshooting/cpu-profiling.rst.txt Begin CPU profiling with Oprofile. ```bash opcontrol --start ``` -------------------------------- ### AWS SNS Get Topic Response Example (Deprecated) Source: https://docs.ceph.com/en/reef/_sources/radosgw/notifications.rst.txt This is an example of the XML response structure when retrieving topic information using the deprecated GetTopic API. ```xml ``` -------------------------------- ### AWS SNS Get Topic Attributes Response Example Source: https://docs.ceph.com/en/reef/_sources/radosgw/notifications.rst.txt This is an example of the XML response structure when retrieving topic attributes using the AWS SNS API. ```xml User Name EndPoint TopicArn OpaqueData ``` -------------------------------- ### Install Frontend Packages Source: https://docs.ceph.com/en/reef/_sources/dev/developer_guide/dash-devel.rst.txt Install the required packages for the frontend development environment. Run this command in the specified directory. ```bash npm ci ``` -------------------------------- ### Setup Includes and Globals for C++ S3 Source: https://docs.ceph.com/en/reef/_sources/radosgw/s3/cpp.rst.txt Includes necessary headers and defines global variables and structures for S3 operations. This setup is used across multiple examples. ```cpp #include "libs3.h" #include #include #include const char access_key[] = "ACCESS_KEY"; const char secret_key[] = "SECRET_KEY"; const char host[] = "HOST"; const char sample_bucket[] = "sample_bucket"; const char sample_key[] = "hello.txt"; const char sample_file[] = "resource/hello.txt"; const char *security_token = NULL; const char *auth_region = NULL; S3BucketContext bucketContext = { host, sample_bucket, S3ProtocolHTTP, S3UriStylePath, access_key, secret_key, security_token, auth_region }; S3Status responsePropertiesCallback( const S3ResponseProperties *properties, void *callbackData) { return S3StatusOK; } static void responseCompleteCallback( S3Status status, const S3ErrorDetails *error, void *callbackData) { return; } S3ResponseHandler responseHandler = { &responsePropertiesCallback, &responseCompleteCallback }; ``` -------------------------------- ### Access WNBD Driver Setup Log Source: https://docs.ceph.com/en/reef/_sources/install/windows-troubleshooting.rst.txt WNBD driver installation failures are logged in this specific file. Check this log for errors related to the WNBD driver setup. ```text C:\Windows\inf\setupapi.dev.log ``` -------------------------------- ### Prepare Filestore OSD with Bare Device Data and Logical Volume Journal Source: https://docs.ceph.com/en/reef/_sources/ceph-volume/lvm/prepare.rst.txt Example of preparing a filestore OSD using a bare device for data and a logical volume for the journal. ```bash ceph-volume lvm prepare --filestore --data /dev/sdc --journal volume_group/journal_lv ``` -------------------------------- ### Enable and Start KDC Servers (SUSE/REDHAT) Source: https://docs.ceph.com/en/reef/_sources/dev/ceph_krb_auth.rst.txt Enable and start the Kerberos Key Distribution Center (KDC) and KDC admin services. Use systemctl for service management. ```bash SUSE: systemctl enable/start krb5kdc systemctl enable/start kadmind REDHAT: systemctl enable/start krb5kdc systemctl enable/start kadmin ``` -------------------------------- ### Clone and Install ceph-iscsi Source: https://docs.ceph.com/en/reef/rbd/iscsi-target-cli-manual-install Clones the ceph-iscsi repository, installs the package and scripts, and copies systemd service files. It is crucial to enable and start the rbd-target-gw and rbd-target-api services afterwards. ```bash git clone https://github.com/ceph/ceph-iscsi.git cd ceph-iscsi python setup.py install --install-scripts=/usr/bin cp usr/lib/systemd/system/rbd-target-gw.service /lib/systemd/system cp usr/lib/systemd/system/rbd-target-api.service /lib/systemd/system ``` ```bash systemctl daemon-reload systemctl enable rbd-target-gw systemctl start rbd-target-gw systemctl enable rbd-target-api systemctl start rbd-target-api ``` -------------------------------- ### Example InfluxDB Configuration Source: https://docs.ceph.com/en/reef/mgr/influx Example commands to configure essential InfluxDB connection details for the Ceph Manager's influx module. Ensure these values match your InfluxDB setup. ```bash ceph config set mgr mgr/influx/hostname influx.mydomain.com ceph config set mgr mgr/influx/username admin123 ceph config set mgr mgr/influx/password p4ssw0rd ``` -------------------------------- ### Example of a basic config option description Source: https://docs.ceph.com/en/reef/_sources/dev/config.rst.txt This example shows the format for a short description of a configuration option. ```yaml desc: Default checksum algorithm to use ``` -------------------------------- ### Describe Block for Test Suite Setup Source: https://docs.ceph.com/en/reef/dev/developer_guide/dash-devel Use describe() blocks to group tests and perform setup operations before the test suite begins. This example shows setting up a pool before tests. ```javascript describe('create, edit & delete image test', () => { const poolName = 'e2e_images_pool'; before(() => { cy.login(); pools.navigateTo('create'); pools.create(poolName, 8, 'rbd'); pools.exist(poolName, true); }); beforeEach(() => { cy.login(); images.navigateTo(); }); //... }); ``` -------------------------------- ### Check Runtime Configuration Option Help Source: https://docs.ceph.com/en/reef/_sources/cephfs/client-config-ref.rst.txt Use `config help` to determine if a configuration option can be applied at runtime. It also shows the default value and a description of the option. ```bash ceph config help debug_client ``` -------------------------------- ### Orchestrator Implementation Setup Source: https://docs.ceph.com/en/reef/mgr/orchestrator_modules Orchestrator implementations should not inherit from OrchestratorClientMixin. This example shows how to correctly set up an implementation class. ```python import mgr_module class MyImplementation(mgr_module.MgrModule, Orchestrator): def __init__(self, ...): self.orch_client = OrchestratorClientMixin() self.orch_client.set_mgr(self.mgr)) ``` -------------------------------- ### Example of tagging config options Source: https://docs.ceph.com/en/reef/_sources/dev/config.rst.txt This example shows how to apply tags to configuration options for categorization, such as 'network' or 'mkfs'. ```yaml tags: - network ``` -------------------------------- ### Example Monitor Configuration Option Source: https://docs.ceph.com/en/reef/_sources/rados/configuration/ceph-conf.rst.txt This example shows a configuration option specific to monitor daemons. ```ini mon_cluster_log_to_syslog = true ``` -------------------------------- ### Start Cephadm Box Cluster (Basic) Source: https://docs.ceph.com/en/reef/_sources/dev/cephadm/developing-cephadm.rst.txt Start a basic Ceph cluster within the cephadm box environment without OSDs or additional hosts. This command can also attempt to set up the cluster if setup was not previously called. ```bash ./box.py -v cluster start ``` -------------------------------- ### Example of specifying multiple services for a config option Source: https://docs.ceph.com/en/reef/_sources/dev/config.rst.txt This example shows how to list multiple services that a configuration option applies to. ```yaml services: - mon - mds - osd - mgr ``` -------------------------------- ### Custom TaskExecutor Implementation Source: https://docs.ceph.com/en/reef/_sources/dev/developer_guide/dash-devel.rst.txt Example of a custom TaskExecutor subclass for executing asynchronous functions, overriding init, start, and finish methods. ```python import json from mgr_module import CommandResult from .. import mgr from ..tools import ApiController, RESTController, NotificationQueue, \ TaskManager, TaskExecutor class SendCommandExecutor(TaskExecutor): def __init__(self): super(SendCommandExecutor, self).__init__() self.tag = None self.result = None def init(self, task): super(SendCommandExecutor, self).init(task) # we need to listen for 'command' events to know when the command # finishes NotificationQueue.register(self._handler, 'command') # store the CommandResult object to retrieve the results self.result = self.task.fn_args[0] if len(self.task.fn_args) > 4: # the user specified a tag for the command, so let's use it self.tag = self.task.fn_args[4] else: # let's generate a unique tag for the command ``` -------------------------------- ### Get help for a Ceph daemon Source: https://docs.ceph.com/en/reef/man/8/ceph Example of submitting a command to a Ceph daemon's admin socket to request its help information. ```bash ceph daemon osd.0 help ``` -------------------------------- ### Example: Set Prometheus Template and Reconfigure Source: https://docs.ceph.com/en/reef/_sources/cephadm/services/monitoring.rst.txt This example demonstrates setting a custom Prometheus configuration template from a local file and then reconfiguring the Prometheus service to apply the changes. ```bash # set the contents of ./prometheus.yml.j2 as template ceph config-key set mgr/cephadm/services/prometheus/prometheus.yml \ -i $PWD/prometheus.yml.j2 # reconfig the prometheus service ``` -------------------------------- ### AWS SNS Get Topic Attributes POST Request Source: https://docs.ceph.com/en/reef/_sources/radosgw/notifications.rst.txt Example of a POST request to retrieve attributes for a specific SNS topic. ```http POST Action=GetTopicAttributes &TopicArn= ``` -------------------------------- ### Enable Image Mirroring Example Source: https://docs.ceph.com/en/reef/rbd/rbd-mirroring Examples demonstrating how to enable mirroring for specific RBD images using either 'snapshot' or 'journal' mode. ```bash $ rbd --cluster site-a mirror image enable image-pool/image-1 snapshot $ rbd --cluster site-a mirror image enable image-pool/image-2 journal ``` -------------------------------- ### Get iSCSI Target List Source: https://docs.ceph.com/en/reef/mgr/ceph_api Retrieves a list of all configured iSCSI targets. This is useful for auditing or understanding the current iSCSI setup. ```http GET /api/iscsi/target HTTP/1.1 Host: example.com ``` -------------------------------- ### Set Automatic Balancing Start Time Source: https://docs.ceph.com/en/reef/_sources/rados/operations/balancer.rst.txt Specify the time of day (in HHMM format) when automatic balancing should begin. For example, '0000' for midnight. ```bash ceph config set mgr mgr/balancer/begin_time 0000 ``` -------------------------------- ### Get Help for Configuration Option Source: https://docs.ceph.com/en/reef/man/8/ceph Provides a description and help information for a specified configuration option. ```bash ceph config help